Skip to content

Commit 2bab723

Browse files
perf(test): replace ts-jest/jasmine2 with @swc/jest/jest-circus
Switch Jest transform from ts-jest to @swc/jest (3-5x faster, Rust-native, no type-checking overhead) and runner from jest-jasmine2 to jest-circus (default since Jest 27, better errors, supports retryTimes). Add explicit testTimeout of 10000ms. Drop separate jsx transform — @swc/jest handles both .ts and .js extensions via unified pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8923465 commit 2bab723

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

packages/pluggable-widgets-tools/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999
"semver": "^7.3.2",
100100
"shelljs": "^0.8.4",
101101
"shx": "^0.3.3",
102+
"@swc/core": "^1.10.0",
103+
"@swc/jest": "^0.2.37",
102104
"ts-jest": "^29.2.5",
103105
"ts-node": "^10.9.2",
104106
"typescript": "^5.6.3",

packages/pluggable-widgets-tools/test-config/jest.config.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ const projectDir = process.cwd();
44

55
module.exports = {
66
clearMocks: true,
7-
testRunner: "jest-jasmine2",
7+
testRunner: "jest-circus/runner",
8+
testTimeout: 10000,
89
rootDir: join(projectDir, "src"),
910
setupFilesAfterEnv: [join(__dirname, "test-index.js")],
1011
testMatch: ["<rootDir>/**/*.spec.{js,jsx,ts,tsx}"],
1112
transform: {
12-
"^.+\\.tsx?$": [
13-
"ts-jest",
13+
"^.+\\.(t|j)sx?$": [
14+
"@swc/jest",
1415
{
15-
tsconfig: { module: "commonjs", target: "ES2019" },
16+
jsc: {
17+
transform: { react: { runtime: "automatic" } },
18+
parser: { syntax: "typescript", tsx: true, decorators: true },
19+
target: "es2019"
20+
},
21+
module: { type: "commonjs" }
1622
}
1723
],
18-
"^.+\\.jsx?$": join(__dirname, "transform.js"),
1924
"^.+\\.svg$": join(__dirname, "jest-svg-transformer")
2025
},
2126
moduleNameMapper: {

0 commit comments

Comments
 (0)