Skip to content

Commit d2c3049

Browse files
committed
add test for exit status when encountering child compilation error
1 parent 71efc0d commit d2c3049

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

test/binCases/errors/child-compilation-error/index.js

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use strict";
2+
3+
module.exports = function testAssertions(code, stdout, stderr) {
4+
code.should.be.eql(2);
5+
6+
stdout[0].should.containEql("Hash: ");
7+
stdout[1].should.containEql("Version: ");
8+
stdout[2].should.containEql("Time: ");
9+
stdout[5].should.containEql("./index.js");
10+
stdout[8].should.containEql("ERROR in child compilation");
11+
12+
stderr.should.be.empty();
13+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use strict";
2+
3+
module.exports = {
4+
entry: "./index",
5+
output: {
6+
filename: "bundle.js"
7+
},
8+
plugins: [{
9+
apply(compiler) {
10+
compiler.plugin("make", (compilation, cb) => {
11+
const child = compilation.createChildCompiler("child", {});
12+
child.plugin("compilation", childCompilation => {
13+
childCompilation.errors.push(new Error("child compilation"));
14+
});
15+
child.runAsChild(cb);
16+
});
17+
}
18+
}]
19+
};

0 commit comments

Comments
 (0)