Skip to content

Commit cca43fe

Browse files
committed
test: use stats.hasErrors & stats.toString instead of stats.compilation
1 parent 2d6b83a commit cca43fe

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Diff for: test/utils.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,13 @@ function bundle (options, cb, wontThrowError) {
8383
webpackCompiler.outputFileSystem = mfs
8484
webpackCompiler.outputFileSystem.join = path.join.bind(path)
8585
webpackCompiler.run((err, stats) => {
86-
const errors = stats.compilation.errors
8786
if (!wontThrowError) {
8887
expect(err).toBeNull()
89-
if (errors && errors.length) {
90-
errors.forEach(error => {
91-
console.error(error)
92-
})
88+
89+
if (stats.hasErrors()) {
90+
return console.error(stats.toString('errors-only'))
9391
}
94-
expect(errors).toHaveLength(0)
92+
expect(stats.hasErrors()).toBeFalsy()
9593
}
9694
cb(mfs.readFileSync('/test.build.js').toString(), stats, err)
9795
})

0 commit comments

Comments
 (0)