Skip to content

Commit 41e9b42

Browse files
authored
refactor(test): Replace Jasmine with Jest (#405)
1 parent aae3b78 commit 41e9b42

9 files changed

+1875
-321
lines changed

.github/workflows/continuous-integration.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
run: |
2525
yarn install --frozen-lockfile
2626
yarn lint
27-
yarn test
27+
yarn test:coverage
2828
if: |
2929
contains(github.event.commits[0].message, '[skip ci]') == false &&
3030
contains(github.event.commits[0].message, '[ci skip]') == false

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.cache
44
.DS_Store
55
.idea/
6-
.nyc_output/
76
.vscode/
87
.yarnclean
98
config.json

jasmine.json

-6
This file was deleted.

jest.config.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"collectCoverage": false,
3+
"collectCoverageFrom": ["**/*.{ts,tsx}", "!**/*.d.ts", "!**/index.ts", "!**/start.ts"],
4+
"coverageReporters": ["html", "lcov", "text"],
5+
"coverageThreshold": {
6+
"global": {
7+
"branches": 100,
8+
"functions": 100,
9+
"lines": 100,
10+
"statements": 100
11+
}
12+
},
13+
"preset": "ts-jest",
14+
"setupFilesAfterEnv": [],
15+
"testEnvironment": "node",
16+
"testRegex": "\\.test\\.tsx?$"
17+
}

nyc.config.coverage.json

-15
This file was deleted.

nyc.config.json

-10
This file was deleted.

package.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
"dependencies": {},
66
"description": "",
77
"devDependencies": {
8-
"@types/jasmine": "3.10.0",
8+
"@types/jest": "27.0.2",
99
"@types/node": "16.11.2",
1010
"@typescript-eslint/eslint-plugin": "5.1.0",
1111
"@typescript-eslint/parser": "5.1.0",
12+
"cross-env": "7.0.3",
1213
"eslint": "8.0.1",
1314
"eslint-config-prettier": "8.3.0",
1415
"eslint-plugin-prettier": "4.0.0",
@@ -17,13 +18,13 @@
1718
"eslint-plugin-unused-imports": "1.1.5",
1819
"generate-changelog": "1.8.0",
1920
"husky": "4.3.8",
20-
"jasmine": "3.10.0",
21+
"jest": "27.3.1",
2122
"lint-staged": "11.2.3",
22-
"nyc": "15.1.0",
2323
"prettier": "2.4.1",
2424
"pretty-quick": "3.1.1",
2525
"rimraf": "3.0.2",
26-
"ts-node": "10.3.0",
26+
"ts-jest": "27.0.7",
27+
"ts-node": "10.3.1",
2728
"typescript": "4.4.4"
2829
},
2930
"engines": {
@@ -48,6 +49,7 @@
4849
"build": "tsc",
4950
"changelog:commit": "git add CHANGELOG.md && git commit -m \"docs: updated CHANGELOG.md\"",
5051
"clean": "rimraf .nyc_output coverage dist",
52+
"dev": "ts-node ./src/start.ts",
5153
"dist": "yarn clean && yarn build",
5254
"fix": "yarn fix:other && yarn fix:code",
5355
"fix:code": "yarn lint:code --fix --quiet",
@@ -63,8 +65,8 @@
6365
"release:minor": "generate-changelog -m -x \"chore,test\" && yarn changelog:commit && npm version minor",
6466
"release:patch": "generate-changelog -p -x \"chore,test\" && yarn changelog:commit && npm version patch",
6567
"start": "ts-node ./src/start.ts",
66-
"test": "nyc --nycrc-path=nyc.config.coverage.json jasmine --config=jasmine.json",
67-
"test:dev": "nyc --nycrc-path=nyc.config.json jasmine --config=jasmine.json",
68+
"test": "cross-env NODE_ENV=test jest ./src",
69+
"test:coverage": "yarn test --coverage",
6870
"test:types": "yarn lint:types"
6971
},
7072
"version": "0.0.0"

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
"strict": true,
2323
"target": "es6"
2424
},
25-
"exclude": ["dist", "node_modules"]
25+
"exclude": ["coverage", "dist", "node_modules"]
2626
}

0 commit comments

Comments
 (0)