Skip to content

Commit 0b79280

Browse files
committed
test: use swc as the jest transformer
1 parent 9fabf05 commit 0b79280

File tree

3 files changed

+48
-16
lines changed

3 files changed

+48
-16
lines changed

jest.config.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
1-
import type { JestConfigWithTsJest } from "ts-jest"
1+
import type { Config } from "jest"
22

3-
const jestConfig: JestConfigWithTsJest = {
3+
const jestConfig: Config = {
44
testMatch: ["**/*.test.ts"],
55
testEnvironment: "node",
6-
// transform configurations
7-
preset: "ts-jest/presets/js-with-ts-esm",
8-
extensionsToTreatAsEsm: [".ts"],
6+
extensionsToTreatAsEsm: [".ts", ".tsx", ".js", ".jsx"],
97
transformIgnorePatterns: [], // transform node_modules
108
transform: {
11-
"^.+\\.tsx?$": [
12-
"ts-jest",
13-
{
14-
importHelpers: true,
15-
useESM: true,
16-
},
17-
],
9+
"^.+\\.(t|j)sx?$": "@swc/jest",
1810
},
1911
// coverage
20-
collectCoverageFrom: ["src/**/*.{ts,tsx}"],
12+
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
2113
coveragePathIgnorePatterns: ["assets", ".css.d.ts"],
2214
verbose: true,
2315
detectOpenHandles: true,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"@actions/io": "^1.1.3",
7777
"@actions/tool-cache": "^2.0.1",
7878
"@babel/cli": "^7.22.9",
79+
"@swc/jest": "^0.2.27",
7980
"@types/cross-spawn": "^6.0.2",
8081
"@types/eslint": "^8.44.0",
8182
"@types/jest": "^29.5.3",

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)