Skip to content

Commit

Permalink
test: Add test for include option in banner plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffin143 committed Apr 19, 2020
1 parent d7b9e7a commit 8915dba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/configCases/plugins/banner-plugin/index.js
Expand Up @@ -13,11 +13,13 @@ it("should contain banner in bundle0 chunk", () => {
expect(source).toMatch(
"/*!\n * trim trailing whitespace\n *\n * no trailing whitespace\n */"
);
expect(source).not.toMatch(new RegExp("^/*! A test value in single file */$"));
});

it("should not contain banner in vendors chunk", () => {
const source = fs.readFileSync(path.join(__dirname, "vendors.js"), "utf-8");
expect(source).not.toMatch("A test value");
expect(source).not.toMatch("/*! A test value */");
expect(source).toMatch("/*! A test value in single file */");
});

if (Math.random() < 0) require("./test.js");
4 changes: 4 additions & 0 deletions test/configCases/plugins/banner-plugin/webpack.config.js
Expand Up @@ -18,6 +18,10 @@ module.exports = {
banner: "A test value",
exclude: ["vendors.js"]
}),
new webpack.BannerPlugin({
banner: "A test value in single file",
include: ["vendors.js"]
}),
new webpack.BannerPlugin({
banner: ({ chunk }) => `multiline\nbanner\n${chunk.name}`
}),
Expand Down

0 comments on commit 8915dba

Please sign in to comment.