Skip to content

Commit 140cbaa

Browse files
committed
add test for progress plugin
1 parent 6d80065 commit 140cbaa

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = [];
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
it("should contain the custom progres messages", function() {
2+
var data = require(__dirname + "/data");
3+
data.should.containEql("optimizing");
4+
data.should.containEql("optimizing|CustomPlugin");
5+
data.should.containEql("optimizing|CustomPlugin|custom category|custom message");
6+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var webpack = require("../../../../");
2+
var data = require("./data");
3+
module.exports = {
4+
externals: {
5+
[__dirname + "/data"]: "commonjs " + __dirname + "/data"
6+
},
7+
plugins: [
8+
new webpack.ProgressPlugin((value, ...messages) => {
9+
data.push(messages.join("|"));
10+
}),
11+
{
12+
apply: (compiler) => {
13+
compiler.hooks.compilation.tap("CustomPlugin", compilation => {
14+
compilation.hooks.optimize.tap({
15+
name: "CustomPlugin",
16+
context: true
17+
}, (context) => {
18+
context.reportProgress(0, "custom category", "custom message");
19+
});
20+
});
21+
}
22+
}
23+
]
24+
};

0 commit comments

Comments
 (0)