Skip to content

Commit f53d6c9

Browse files
committed
refactor(test): use jest as test runner
1 parent ae44f9b commit f53d6c9

16 files changed

+13544
-8555
lines changed

.nycrc.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

jest.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
4+
testEnvironment: 'node',
5+
testMatch: [
6+
'<rootDir>/**/__tests__/**/*.{js,jsx,ts,tsx}',
7+
'<rootDir>/**/*.{spec,test}.{js,jsx,ts,tsx}',
8+
],
9+
testPathIgnorePatterns: ['/node_modules/'],
10+
globals: {
11+
'ts-jest': {
12+
tsconfig: 'tsconfig.json',
13+
isolatedModules: true,
14+
},
15+
},
16+
transform: {
17+
'^.+\\.([t|j]sx?)$': 'ts-jest',
18+
},
19+
collectCoverage: true,
20+
coverageReporters: ['text', 'html'],
21+
coverageDirectory: './coverage',
22+
};

package-lock.json

Lines changed: 13128 additions & 8096 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
"README.md"
1414
],
1515
"scripts": {
16-
"test": "mocha --require ts-node/register 'test/**/*.spec.{ts,tsx}'",
17-
"coverage": "nyc npm run test",
16+
"test": "jest",
17+
"test:watch": "jest --watch",
18+
"coverage": "jest --coverage",
1819
"lint": "gts lint",
1920
"clean": "gts clean",
2021
"compile": "tsc",
@@ -36,9 +37,9 @@
3637
}
3738
},
3839
"devDependencies": {
39-
"@istanbuljs/nyc-config-typescript": "^1.0.1",
4040
"@testing-library/react": "^12.1.3",
4141
"@types/chance": "^1.1.3",
42+
"@types/jest": "^27.4.1",
4243
"@types/jsdom": "^16.2.14",
4344
"@types/mocha": "^9.0.0",
4445
"@types/nock": "^11.1.0",
@@ -49,14 +50,14 @@
4950
"chance": "^1.1.8",
5051
"eslint-plugin-prettier": "^4.0.0",
5152
"gts": "^3.1.0",
53+
"jest": "^27.5.1",
5254
"jsdom": "^19.0.0",
5355
"mocha": "^9.1.3",
5456
"nock": "^13.2.0",
55-
"nyc": "^15.1.0",
5657
"react": "^17.0.2",
5758
"react-dom": "^17.0.2",
58-
"should": "^13.2.3",
5959
"sinon": "^12.0.1",
60+
"ts-jest": "^27.1.4",
6061
"ts-node": "^10.4.0",
6162
"typescript": "^4.0.3"
6263
},

0 commit comments

Comments
 (0)