Skip to content

Commit

Permalink
add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Aug 1, 2019
1 parent 94bcce0 commit 53a7a34
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/configCases/asset-emitted/futureEmitAssets/index.js
@@ -0,0 +1,3 @@
import("./module");

it("should run", () => {});
Empty file.
21 changes: 21 additions & 0 deletions test/configCases/asset-emitted/futureEmitAssets/webpack.config.js
@@ -0,0 +1,21 @@
module.exports = {
output: {
futureEmitAssets: true
},
plugins: [
compiler => {
const files = {};
compiler.hooks.assetEmitted.tap("Test", (file, buffer) => {
files[file] = Buffer.isBuffer(buffer);
});
compiler.hooks.afterEmit.tap("Test", () => {
expect(files).toMatchInlineSnapshot(`
Object {
"1.bundle0.js": true,
"bundle0.js": true,
}
`);
});
}
]
};
3 changes: 3 additions & 0 deletions test/configCases/asset-emitted/normal/index.js
@@ -0,0 +1,3 @@
import("./module");

it("should run", () => {});
Empty file.
18 changes: 18 additions & 0 deletions test/configCases/asset-emitted/normal/webpack.config.js
@@ -0,0 +1,18 @@
module.exports = {
plugins: [
compiler => {
const files = {};
compiler.hooks.assetEmitted.tap("Test", (file, buffer) => {
files[file] = Buffer.isBuffer(buffer);
});
compiler.hooks.afterEmit.tap("Test", () => {
expect(files).toMatchInlineSnapshot(`
Object {
"1.bundle0.js": true,
"bundle0.js": true,
}
`);
});
}
]
};

0 comments on commit 53a7a34

Please sign in to comment.