Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c070aeb

Browse filesBrowse files
committed
chore: use env variable to choose the webpack version to test
1 parent 77d9256 commit c070aeb
Copy full SHA for c070aeb

File tree

3 files changed

+20
-17
lines changed
Filter options

3 files changed

+20
-17
lines changed

‎jest-webpack5.config.js

Copy file name to clipboardExpand all lines: jest-webpack5.config.js
-15Lines changed: 0 additions & 15 deletions
This file was deleted.

‎jest.config.js

Copy file name to clipboard
+19-1Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
module.exports = {
1+
const config = {
22
preset: 'ts-jest',
33
testTimeout: 10000,
44
testEnvironment: 'node',
55
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/node_modules/'],
66
}
7+
8+
if (process.env.WEBPACK5) {
9+
module.exports = {
10+
...config,
11+
12+
globals: {
13+
'ts-jest': {
14+
diagnostics: false,
15+
},
16+
},
17+
moduleNameMapper: {
18+
'^webpack$': 'webpack5',
19+
'^webpack/(.*)': 'webpack5/$1',
20+
},
21+
}
22+
} else {
23+
module.exports = config
24+
}

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"build": "tsc",
1414
"pretest": "tsc",
1515
"test": "jest --coverage",
16-
"test:webpack5": "jest -c jest-webpack5.config.js --coverage",
16+
"test:webpack5": "WEBPACK5=true jest -c --coverage",
1717
"dev-example": "webpack-dev-server --config example/webpack.config.js --inline --hot",
1818
"build-example": "rm -rf example/dist && webpack --config example/webpack.config.js --env.prod",
1919
"lint": "prettier --write --parser typescript \"{src,test}/**/*.{j,t}s\"",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.