Skip to content

Commit 4f112af

Browse files
committed
test: boost test performance using swc
1 parent a3fba93 commit 4f112af

File tree

5 files changed

+296
-19
lines changed

5 files changed

+296
-19
lines changed

jest.config.ts renamed to jest.config.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export default {
104104

105105
// A preset that is used as a base for Jest's configuration
106106
// preset: undefined,
107-
preset: "ts-jest/presets/js-with-ts",
108107

109108
// Run tests from one or more projects
110109
// projects: undefined,
@@ -199,14 +198,23 @@ export default {
199198
// '^.+\\.tsx?$': 'babel-jest',
200199
// },
201200
transform: {
202-
"^.+\\.tsx?$": [
203-
"ts-jest",
201+
"^.+\\.(t|j)sx?$": [
202+
"@swc/jest",
204203
{
205-
/* ts-jest config goes here in Jest */
204+
jsc: {
205+
parser: {
206+
syntax: "typescript",
207+
decorators: true, // Enable decorator parsing
208+
},
209+
keepClassNames: true,
210+
transform: {
211+
legacyDecorator: true, // Use legacy decorator behavior (common for TS projects)
212+
decoratorMetadata: true, // Enable metadata emission (like emitDecoratorMetadata in tsconfig)
213+
},
214+
},
206215
},
207216
],
208217
},
209-
210218
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
211219
// transformIgnorePatterns: [
212220
// "/node_modules/",

jest.setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
// Required for class-transformer
12
// See https://stackoverflow.com/a/67371037/236784
23
import "reflect-metadata"

package-lock.json

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

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"ci": "npm run ci:build && npm run ci:test && npm run ci:docs",
1313
"ci:build": "npm run clean && npm ci && npm run build && npm run lint:code",
1414
"ci:docs": "npm run clean:docs && npm ci && ( cd docs && npm ci ) && npm run build:docs",
15-
"ci:test": "TZ=Etc/UTC jest --runInBand -i --ci --coverage",
15+
"ci:test": "TZ=Etc/UTC npx jest --runInBand --ci --coverage",
1616
"clean": "rm -rf build docs/build",
1717
"clean:docs": "rm -rf docs/build",
1818
"clean:examples": "scripts/clasp.sh examples clean",
@@ -109,6 +109,8 @@
109109
"@rollup/plugin-replace": "6.0.2",
110110
"@rollup/plugin-terser": "0.4.4",
111111
"@rollup/plugin-typescript": "12.1.2",
112+
"@swc/core": "^1.11.24",
113+
"@swc/jest": "^0.2.38",
112114
"@types/addressparser": "1.0.3",
113115
"@types/crypto-js": "4.2.2",
114116
"@types/google-apps-script": "1.0.97",

0 commit comments

Comments
 (0)