Skip to content

Commit 9c0036b

Browse files
committed
Add a test
1 parent 737eaa5 commit 9c0036b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/ProgressPlugin.test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"use strict";
2+
3+
const path = require("path");
4+
const MemoryFs = require("memory-fs");
5+
const webpack = require("../");
6+
7+
const createMultiCompiler = () => {
8+
const compiler = webpack([
9+
{
10+
context: path.join(__dirname, "fixtures"),
11+
entry: "./a.js"
12+
},
13+
{
14+
context: path.join(__dirname, "fixtures"),
15+
entry: "./b.js"
16+
}
17+
]);
18+
compiler.outputFileSystem = new MemoryFs();
19+
return compiler;
20+
};
21+
22+
describe("ProgressPlugin", function() {
23+
it("should not contain NaN as a percentage when it is applied to MultiCompiler", function(done) {
24+
const compiler = createMultiCompiler();
25+
26+
let percentage = 0;
27+
new webpack.ProgressPlugin((p, msg, ...args) => {
28+
percentage += p;
29+
}).apply(compiler);
30+
31+
compiler.run(err => {
32+
if (err) {
33+
throw err;
34+
} else {
35+
expect(percentage).not.toBe(NaN);
36+
done();
37+
}
38+
});
39+
});
40+
});

0 commit comments

Comments
 (0)