Skip to content

Commit

Permalink
test: add test case to pr-16701
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Apr 22, 2024
2 parents b630e21 + 5c98c08 commit 6d58e8d
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/configCases/inner-graph/pr-18342/common/index.js
@@ -0,0 +1,5 @@
import pure from './pure'

export default () => {
pure()
}
5 changes: 5 additions & 0 deletions test/configCases/inner-graph/pr-18342/common/pure.js
@@ -0,0 +1,5 @@
function pure() {
console.log('pureFn');
}

export default pure
7 changes: 7 additions & 0 deletions test/configCases/inner-graph/pr-18342/entry1/index.js
@@ -0,0 +1,7 @@
import common from "../common";

it("entry1 should compile and run", () => {
common()
console.log('entry1');
expect(true).toBe(true)
});
7 changes: 7 additions & 0 deletions test/configCases/inner-graph/pr-18342/entry2/index.js
@@ -0,0 +1,7 @@
it("entry2 should compile and run", () => {
import(/* webpackChunkName: "chunk-reason-webpackChunkName" */'../common').then(common => {
common.default()
console.log('entry2');
expect(true).toBe(true)
})
});
1 change: 1 addition & 0 deletions test/configCases/inner-graph/pr-18342/entry3/a.js
@@ -0,0 +1 @@
export default 'a'
7 changes: 7 additions & 0 deletions test/configCases/inner-graph/pr-18342/entry3/index.js
@@ -0,0 +1,7 @@
it("entry3 should compile and run", () => {
import(/* webpackChunkName: "chunk-reason-webpackChunkName" */'./a.js').then(a => {
console.log(a.default);
console.log('entry3');
expect(true).toBe(true)
})
});
8 changes: 8 additions & 0 deletions test/configCases/inner-graph/pr-18342/test.config.js
@@ -0,0 +1,8 @@
const findOutputFiles = require("../../../helpers/findOutputFiles");

module.exports = {
findBundle(_, options) {
const files = findOutputFiles(options, new RegExp(`^entry`));
return files;
}
};
26 changes: 26 additions & 0 deletions test/configCases/inner-graph/pr-18342/webpack.config.js
@@ -0,0 +1,26 @@
module.exports = {
target: ["node"],
entry: {
entry1: ["./entry1/index.js"],
entry2: ["./entry2/index.js"],
entry3: ["./entry3/index.js"]
},
output: {
filename: "[name].js",
chunkFilename: "[name].chunk.js"
},
optimization: {
minimize: false,
runtimeChunk: true,
splitChunks: {
chunks: "initial",
cacheGroups: {
pureFn: {
test: /pure/,
enforce: true,
name: "chunk-reason-split-chunks"
}
}
}
}
};

0 comments on commit 6d58e8d

Please sign in to comment.