Skip to content

Commit 4dac1cb

Browse files
SukkaWJounQin
andauthored
chore/test: repalce ts-jest with @swc-node/jest (#58)
Co-authored-by: JounQin <admin@1stg.me>
1 parent 4fb9263 commit 4dac1cb

File tree

4 files changed

+261
-35
lines changed

4 files changed

+261
-35
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ lib/
3737

3838
# macOS
3939
.DS_Store
40+
.*cache

jest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import type { Options as SwcOptions } from '@swc/core'
12
import type { Config } from 'jest'
23

34
const testCompiled = process.env.TEST_COMPILED === '1'
45

56
const srcDir = testCompiled ? 'lib' : 'src'
67

78
export default {
8-
preset: 'ts-jest',
99
collectCoverage: !testCompiled,
1010
modulePathIgnorePatterns: ['<rootDir>/test/fixtures/with-syntax-error'],
1111
moduleNameMapper: {
@@ -15,6 +15,6 @@ export default {
1515
},
1616
testMatch: ['<rootDir>/test/**/*.spec.ts'],
1717
transform: {
18-
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.base.json' }],
18+
'^.+\\.(t|j)sx?$': ['@swc-node/jest', {} satisfies SwcOptions],
1919
},
2020
} satisfies Config

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373
"@changesets/changelog-github": "^0.5.0",
7474
"@changesets/cli": "^2.27.1",
7575
"@eslint/import-test-order-redirect-scoped": "link:./test/fixtures/order-redirect-scoped",
76+
"@swc-node/jest": "^1.8.0",
77+
"@swc/core": "^1.4.8",
78+
"@swc/helpers": "^0.5.7",
7679
"@test-scope/some-module": "link:./test/fixtures/symlinked-module",
7780
"@total-typescript/ts-reset": "^0.5.1",
7881
"@types/debug": "^4.1.12",
@@ -108,7 +111,6 @@
108111
"redux": "^5.0.1",
109112
"rimraf": "^5.0.5",
110113
"svelte": "^4.2.12",
111-
"ts-jest": "^29.1.2",
112114
"ts-node": "^10.9.2",
113115
"type-fest": "^4.12.0",
114116
"typescript": "~5.1.0"

0 commit comments

Comments
 (0)