Skip to content

Commit

Permalink
Merge pull request #7429 from webpack/test/issue-7401
Browse files Browse the repository at this point in the history
add test cases for #7401
  • Loading branch information
sokra committed May 29, 2018
2 parents 67fa81f + 504148c commit 4fc3981
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/__snapshots__/StatsTestCases.test.js.snap
Expand Up @@ -2571,6 +2571,25 @@ chunk {3} vendors.js (vendors) 20 bytes ={2}= >{0}< >{1}< [initial] [rendered
[4] ./node_modules/y.js 20 bytes {3} [built]"
`;

exports[`StatsTestCases should print correct stats for split-chunks-issue-7401 1`] = `
"Entrypoint a = vendors~a~c.js a.js
Entrypoint b = b.js
Chunk Group c = vendors~a~c.js c.js
chunk {0} vendors~a~c.js (vendors~a~c) 20 bytes <{3}> ={1}= ={2}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~c)
> ./a a
> ./c [3] ./b.js 1:0-41
[0] ./node_modules/x.js 20 bytes {0} [built]
chunk {1} c.js (c) 12 bytes <{3}> ={0}= [rendered]
> ./c [3] ./b.js 1:0-41
[1] ./c.js 12 bytes {1} [built]
chunk {2} a.js (a) 12 bytes ={0}= [entry] [rendered]
> ./a a
[2] ./a.js 12 bytes {2} [built]
chunk {3} b.js (b) 43 bytes >{0}< >{1}< [entry] [rendered]
> ./b b
[3] ./b.js 43 bytes {3} [built]"
`;

exports[`StatsTestCases should print correct stats for split-chunks-prefer-bigger-splits 1`] = `
"Entrypoint main = default/main.js
chunk {0} default/async-b~async-c.js (async-b~async-c) 110 bytes <{4}> ={2}= ={3}= [rendered] split chunk (cache group: default) (name: async-b~async-c)
Expand Down
1 change: 1 addition & 0 deletions test/statsCases/split-chunks-issue-7401/a.js
@@ -0,0 +1 @@
import "x";
1 change: 1 addition & 0 deletions test/statsCases/split-chunks-issue-7401/b.js
@@ -0,0 +1 @@
import(/* webpackChunkName: "c" */ "./c");
1 change: 1 addition & 0 deletions test/statsCases/split-chunks-issue-7401/c.js
@@ -0,0 +1 @@
import "x";
1 change: 1 addition & 0 deletions test/statsCases/split-chunks-issue-7401/node_modules/x.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions test/statsCases/split-chunks-issue-7401/webpack.config.js
@@ -0,0 +1,29 @@
const stats = {
hash: false,
timings: false,
builtAt: false,
assets: false,
chunks: true,
chunkOrigins: true,
entrypoints: true,
chunkGroups: true,
modules: false
};
module.exports = {
name: "default",
mode: "production",
entry: {
a: "./a",
b: "./b"
},
output: {
filename: "[name].js"
},
optimization: {
splitChunks: {
minSize: 0, // enforce all
chunks: "all"
}
},
stats
};

0 comments on commit 4fc3981

Please sign in to comment.