Skip to content

Commit

Permalink
test: use stats.hasErrors & stats.toString instead of stats.compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Dec 17, 2020
1 parent 2d6b83a commit cca43fe
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/utils.js
Expand Up @@ -83,15 +83,13 @@ function bundle (options, cb, wontThrowError) {
webpackCompiler.outputFileSystem = mfs
webpackCompiler.outputFileSystem.join = path.join.bind(path)
webpackCompiler.run((err, stats) => {
const errors = stats.compilation.errors
if (!wontThrowError) {
expect(err).toBeNull()
if (errors && errors.length) {
errors.forEach(error => {
console.error(error)
})

if (stats.hasErrors()) {
return console.error(stats.toString('errors-only'))
}
expect(errors).toHaveLength(0)
expect(stats.hasErrors()).toBeFalsy()
}
cb(mfs.readFileSync('/test.build.js').toString(), stats, err)
})
Expand Down

0 comments on commit cca43fe

Please sign in to comment.