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

Commit 38b3ec1

Browse files
committed
Act on compilation event
1 parent caf9aa3 commit 38b3ec1

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

test/plugin-create-asset-test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ test.cb("create asset", t => {
2626
}
2727
};
2828

29-
const pluginEvent = (compilerEvent, compile) => {
30-
t.is(compilerEvent, "compilation");
31-
32-
const assets = {};
33-
assets[manifestFilename] = {
34-
source: () => manifestFileContent
35-
};
29+
const pluginEvent = (event, compile) => {
30+
if (event === "compilation") {
31+
const assets = {};
32+
assets[manifestFilename] = {
33+
source: () => manifestFileContent
34+
};
3635

37-
const compilation = {
38-
plugin: compilationPluginEvent,
39-
assets: assets
40-
};
36+
const compilation = {
37+
plugin: compilationPluginEvent,
38+
assets: assets
39+
};
4140

42-
compile(compilation);
41+
compile(compilation);
42+
}
4343
};
4444

4545
const fakeCompiler = { plugin: pluginEvent };

test/plugin-inject-manifest-test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ test.cb("inject manifest in head", t => {
2727
}
2828
};
2929

30-
const pluginEvent = (compilerEvent, compile) => {
31-
t.is(compilerEvent, "compilation");
32-
33-
const assets = {};
34-
assets[manifestFilename] = {
35-
source: () => manifestFileContent
36-
};
30+
const pluginEvent = (event, compile) => {
31+
if (event === "compilation") {
32+
const assets = {};
33+
assets[manifestFilename] = {
34+
source: () => manifestFileContent
35+
};
3736

38-
const compilation = {
39-
plugin: compilationPluginEvent,
40-
assets: assets
41-
};
37+
const compilation = {
38+
plugin: compilationPluginEvent,
39+
assets: assets
40+
};
4241

43-
compile(compilation);
42+
compile(compilation);
43+
}
4444
};
4545

4646
const fakeCompiler = { plugin: pluginEvent };

0 commit comments

Comments
 (0)