Skip to content

Commit 905e3d5

Browse files
committed
stricter testing of hash and chunkhash interpolation
1 parent 6891945 commit 905e3d5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

test/configCases/plugins/banner-plugin-hashing/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ var source = require("fs")
1515
.slice(0,1)[0];
1616

1717
const banner = parseBanner(source)
18+
const REGEXP_HASH = /^[A-Za-z0-9]{20}$/
1819

1920
it("should interpolate file hash in bundle0 chunk", () => {
20-
banner["hash"].should.not.equal("[hash]");
21+
REGEXP_HASH.test(banner["hash"]).should.be.true;
2122
});
2223

2324
it("should interpolate chunkHash in bundle0 chunk", () => {
24-
banner["chunkhash"].should.not.equal("[chunkhash]");
25+
REGEXP_HASH.test(banner["chunkhash"]).should.be.true;
2526
});
2627

2728
it("should interpolate name in bundle0 chunk", () => {
28-
banner["name"].should.not.equal("[name]");
29+
banner["name"].should.equal("banner");
2930
});
3031

3132
it("should interpolate extension in bundle0 chunk", () => {
32-
banner["ext"].should.not.equal("[filebase]");
33+
banner["basename"].should.equal("banner.js");
3334
});
3435

3536
it("should interpolate extension in bundle0 chunk", () => {

test/configCases/plugins/banner-plugin-hashing/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414
},
1515
plugins: [
1616
new webpack.BannerPlugin({
17-
banner: "hash:[hash], chunkhash:[chunkhash], name:[name], ext:[filebase], query:[query]"
17+
banner: "hash:[hash], chunkhash:[chunkhash], name:[name], basename:[filebase], query:[query]"
1818
})
1919
]
2020
};

0 commit comments

Comments
 (0)