Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 18a9f88

Browse files
committed
Add initial test config
1 parent 2340f86 commit 18a9f88

File tree

3 files changed

+2122
-51
lines changed

3 files changed

+2122
-51
lines changed

jest.config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const maxWorkers = process.env.CI ? 16 : 2
2+
3+
module.exports = {
4+
maxWorkers,
5+
projects: [
6+
{
7+
coverageReporters: ["text", "lcov"],
8+
9+
displayName: "test",
10+
preset: "ts-jest",
11+
roots: [
12+
"<rootDir>/site/src",
13+
],
14+
transform: {
15+
"^.+\\.tsx?$": "ts-jest",
16+
},
17+
testEnvironment: "jsdom",
18+
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
19+
testPathIgnorePatterns: ["/node_modules/", "/__tests__/fakes"],
20+
moduleDirectories: ["node_modules", "<rootDir>"],
21+
},
22+
],
23+
collectCoverageFrom: [
24+
"<rootDir>/site/src/**/*.js",
25+
"<rootDir>/site/src/**/*.ts",
26+
"<rootDir>/site/src/**/*.tsx",
27+
"!<rootDir>/site/src/**/*.stories.tsx",
28+
]
29+
}

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,25 @@
77
"build": "webpack build --config site/webpack.config.js",
88
"build:watch": "webpack build --config site/webpack.config.js --watch",
99
"format:check": "prettier --check '**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'",
10-
"format:write": "prettier --write '**/*.{css,htmljs,json,jsx,md,ts,tsx,yaml,yml}'"
10+
"format:write": "prettier --write '**/*.{css,htmljs,json,jsx,md,ts,tsx,yaml,yml}'",
11+
"test": "jest --selectProjects test"
1112
},
1213
"devDependencies": {
1314
"@material-ui/core": "4.9.4",
1415
"@material-ui/icons": "4.5.1",
1516
"@material-ui/lab": "4.0.0-alpha.42",
17+
"@types/jest": "27.4.0",
1618
"@types/node": "14.18.4",
1719
"@types/react": "17.0.38",
1820
"@types/react-dom": "17.0.11",
1921
"@types/react-router-dom": "5.1.8",
2022
"@types/superagent": "4.1.14",
23+
"jest": "27.4.7",
2124
"prettier": "2.5.1",
2225
"react": "17.0.2",
2326
"react-dom": "17.0.2",
2427
"react-router-dom": "5.1.2",
28+
"ts-jest": "27.1.2",
2529
"ts-loader": "9.2.6",
2630
"typescript": "4.5.4",
2731
"webpack": "5.65.0",

0 commit comments

Comments
 (0)