Skip to content

Commit caf273f

Browse files
authored
Merge pull request webpack#6215 from webpack/test/no-emit-watch
add test case for no emit in watch mode
2 parents 7ed2bd2 + 0abdc0a commit caf273f

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

test/Compiler.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,25 @@ describe("Compiler", () => {
261261
done();
262262
});
263263
});
264+
it("should not emit on errors (watch)", function(done) {
265+
const compiler = webpack({
266+
context: __dirname,
267+
mode: "production",
268+
entry: "./missing",
269+
output: {
270+
path: "/",
271+
filename: "bundle.js"
272+
}
273+
});
274+
compiler.outputFileSystem = new MemoryFs();
275+
const watching = compiler.watch({}, (err, stats) => {
276+
watching.close();
277+
if(err) return done(err);
278+
if(compiler.outputFileSystem.existsSync("/bundle.js"))
279+
return done(new Error("Bundle should not be created on error"));
280+
done();
281+
});
282+
});
264283
describe("Watching", () => {
265284
let compiler;
266285
beforeEach(() => {

0 commit comments

Comments
 (0)