This repository has been archived by the owner on Sep 28, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix not returning execution flow control to webpack when cache option…
… is enabled and one of the files has a linting error (#224) * Fix webpack hanging when `failOnError` and are enabled and there is a formatting error * Add tests for the combination of emit+async+failOnError
- Loading branch information
Showing
2 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
var test = require("ava") | ||
|
||
var webpack = require("webpack") | ||
var conf = require("./utils/conf") | ||
|
||
test.cb("emits errors in async mode", function(t) { | ||
t.plan(1) | ||
webpack(conf( | ||
{ | ||
cache: true, | ||
entry: "./test/fixtures/error.js", | ||
},{ | ||
failOnError: true, | ||
emitError: true, | ||
cache: true, | ||
} | ||
), | ||
function(err, stats) { | ||
if (err) { | ||
throw err | ||
} | ||
|
||
// console.log(stats.compilation.errors) | ||
t.true( | ||
stats.hasErrors(), | ||
"a file that contains eslint errors should return error" | ||
) | ||
t.end() | ||
}) | ||
}) | ||
|
||
test.cb("correctly indentifies a success", function(t) { | ||
t.plan(1) | ||
webpack(conf( | ||
{ | ||
cache: true, | ||
entry: "./test/fixtures/good.js", | ||
},{ | ||
failOnError: true, | ||
emitError: true, | ||
cache: true, | ||
} | ||
), | ||
function(err, stats) { | ||
if (err) { | ||
throw err | ||
} | ||
|
||
// console.log(stats.compilation.errors) | ||
t.false( | ||
stats.hasErrors(), | ||
"a file that doesn't contains eslint errors should not return errors" | ||
) | ||
t.end() | ||
}) | ||
}) |