Skip to content

Commit 299d607

Browse files
committed
feat: jest to use swc
1 parent 75851db commit 299d607

13 files changed

+960
-205
lines changed

.pnp.cjs

+493-124
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

config/jest/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@atls/config-jest",
3-
"version": "0.0.18",
3+
"version": "0.1.0",
44
"license": "BSD-3-Clause",
55
"main": "src/index.ts",
66
"files": [
@@ -16,10 +16,11 @@
1616
"@atls/jest-static-stubs": "workspace:*",
1717
"@emotion/jest": "11.11.0",
1818
"@monstrs/jest-pnp-resolver": "0.0.1",
19-
"ts-jest": "29.1.2"
19+
"@swc/core": "1.5.7",
20+
"@swc/jest": "0.2.36"
2021
},
2122
"devDependencies": {
22-
"@types/node": "18.19.15",
23+
"@types/node": "20",
2324
"jest": "29.7.0",
2425
"typescript": "5.2.2"
2526
},

config/jest/src/index.ts

+44-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type { Config } from 'jest'
22

3-
import { tsConfig } from '@atls/config-typescript'
4-
53
export const unit: Config = {
64
transformIgnorePatterns: ['/node_modules/', '\\.pnp\\.[^\\/]+$'],
75
modulePathIgnorePatterns: ['dist', 'integration'],
@@ -12,13 +10,31 @@ export const unit: Config = {
1210
'@atls/jest-static-stubs/$1',
1311
},
1412
globals: {},
13+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
1514
transform: {
1615
'^.+\\.[tj]sx?$': [
17-
require.resolve('ts-jest'),
16+
require.resolve('@swc/jest'),
1817
{
19-
tsconfig: tsConfig.compilerOptions,
20-
isolatedModules: true,
21-
diagnostics: false,
18+
minify: false,
19+
jsc: {
20+
parser: {
21+
syntax: 'typescript',
22+
jsx: true,
23+
dynamicImport: true,
24+
privateMethod: true,
25+
functionBind: true,
26+
exportDefaultFrom: true,
27+
exportNamespaceFrom: true,
28+
decorators: true,
29+
decoratorsBeforeExport: true,
30+
topLevelAwait: true,
31+
importMeta: true,
32+
},
33+
transform: {
34+
legacyDecorator: true,
35+
decoratorMetadata: true,
36+
},
37+
},
2238
},
2339
],
2440
},
@@ -34,13 +50,31 @@ export const integration: Config = {
3450
'@atls/jest-static-stubs/$1',
3551
},
3652
globals: {},
53+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
3754
transform: {
3855
'^.+\\.[tj]sx?$': [
39-
require.resolve('ts-jest'),
56+
require.resolve('@swc/jest'),
4057
{
41-
tsconfig: tsConfig.compilerOptions,
42-
isolatedModules: true,
43-
diagnostics: false,
58+
minify: false,
59+
jsc: {
60+
parser: {
61+
syntax: 'typescript',
62+
jsx: true,
63+
dynamicImport: true,
64+
privateMethod: true,
65+
functionBind: true,
66+
exportDefaultFrom: true,
67+
exportNamespaceFrom: true,
68+
decorators: true,
69+
decoratorsBeforeExport: true,
70+
topLevelAwait: true,
71+
importMeta: true,
72+
},
73+
transform: {
74+
legacyDecorator: true,
75+
decoratorMetadata: true,
76+
},
77+
},
4478
},
4579
],
4680
},

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@angular-devkit/schematics": "17.0.8",
2929
"@atls/code-service": "workspace:*",
3030
"@atls/config-eslint": "workspace:0.0.12",
31-
"@atls/config-jest": "workspace:0.0.18",
31+
"@atls/config-jest": "workspace:*",
3232
"@atls/schematics": "workspace:*",
3333
"@atls/tools-setup-ts-execution": "workspace:0.0.1",
3434
"@jest/core": "29.7.0",

0 commit comments

Comments
 (0)