Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

Commit 373ab01

Browse files
committed
Can apply plugin(s)
1 parent 3b4b02d commit 373ab01

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test/plugin-apply-test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import test from "ava";
2+
import InlineChunkManifestHtmlWebpackPlugin from "../src/";
3+
import ChunkManifestPlugin from "chunk-manifest-webpack-plugin";
4+
5+
test("plugin and dependency plugins has apply", t => {
6+
const plugin = new InlineChunkManifestHtmlWebpackPlugin();
7+
const manifestPlugin = plugin.plugins[0];
8+
9+
t.is(typeof plugin.apply, "function");
10+
t.is(typeof manifestPlugin.apply, "function");
11+
});
12+
13+
test.cb("dependency plugins are applied", t => {
14+
t.plan(2);
15+
16+
const fakeCompiler = { plugin: () => {} };
17+
18+
const dependencyPlugin = {
19+
apply: compiler => {
20+
t.is(compiler, fakeCompiler);
21+
}
22+
};
23+
24+
const anotherDependencyPlugin = {
25+
apply: compiler => {
26+
t.is(compiler, fakeCompiler);
27+
t.end();
28+
}
29+
};
30+
31+
const plugin = new InlineChunkManifestHtmlWebpackPlugin();
32+
plugin.plugins = [dependencyPlugin, anotherDependencyPlugin];
33+
plugin.apply(fakeCompiler);
34+
});

0 commit comments

Comments
 (0)