Commit cca43fe3 authored by Haoqun Jiang's avatar Haoqun Jiang

test: use stats.hasErrors & stats.toString instead of stats.compilation

parent 2d6b83ab
......@@ -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)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment