Skip to content

Commit

Permalink
chore: replace ts-jest to @swc/jest
Browse files Browse the repository at this point in the history
- before: ~10s
- after: ~3s
  • Loading branch information
leegeunhyeok committed Oct 25, 2023
1 parent 09e5ba3 commit fcea8b9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 61 deletions.
Binary file not shown.
Binary file not shown.
28 changes: 16 additions & 12 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,73 +1,77 @@
import type { JestConfigWithTsJest } from 'ts-jest';
import type { Config } from 'jest';

const config: JestConfigWithTsJest = {
const transform = {
'^.+\\.(t|j)sx?$': '@swc/jest',
};

const config: Config = {
projects: [
{
displayName: '@react-native-esbuild/cli',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/cli/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
},
{
displayName: '@react-native-esbuild/config',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/config/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
},
{
displayName: '@react-native-esbuild/core',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/core/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
},
{
displayName: '@react-native-esbuild/config',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/config/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
},
{
displayName: '@react-native-esbuild/dev-server',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/dev-server/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
},
{
displayName: '@react-native-esbuild/internal',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/internal/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
},
{
displayName: '@react-native-esbuild/plugins',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/plugins/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
},
{
displayName: '@react-native-esbuild/symbolicate',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/symbolicate/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
},
{
displayName: '@react-native-esbuild/transformer',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/transformer/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
},
{
displayName: '@react-native-esbuild/utils',
preset: 'ts-jest',
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/packages/utils/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@faker-js/faker": "^8.1.0",
"@swc/core": "^1.3.95",
"@swc/jest": "^0.2.29",
"@types/invariant": "^2.2.36",
"@types/jest": "^29.5.5",
"@types/node": "^20.6.2",
Expand All @@ -35,7 +37,6 @@
"prettier": "^3.0.3",
"react-native": "0.72.6",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
Expand Down
55 changes: 7 additions & 48 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7401,15 +7401,6 @@ __metadata:
languageName: node
linkType: hard

"bs-logger@npm:0.x":
version: 0.2.6
resolution: "bs-logger@npm:0.2.6"
dependencies:
fast-json-stable-stringify: 2.x
checksum: d34bdaf68c64bd099ab97c3ea608c9ae7d3f5faa1178b3f3f345acd94e852e608b2d4f9103fb2e503f5e69780e98293df41691b84be909b41cf5045374d54606
languageName: node
linkType: hard

"bser@npm:2.1.1":
version: 2.1.1
resolution: "bser@npm:2.1.1"
Expand Down Expand Up @@ -10907,7 +10898,7 @@ __metadata:
languageName: node
linkType: hard

"fast-json-stable-stringify@npm:2.x, fast-json-stable-stringify@npm:^2.0.0, fast-json-stable-stringify@npm:^2.1.0":
"fast-json-stable-stringify@npm:^2.0.0, fast-json-stable-stringify@npm:^2.1.0":
version: 2.1.0
resolution: "fast-json-stable-stringify@npm:2.1.0"
checksum: b191531e36c607977e5b1c47811158733c34ccb3bfde92c44798929e9b4154884378536d26ad90dfecd32e1ffc09c545d23535ad91b3161a27ddbb8ebe0cbecb
Expand Down Expand Up @@ -13895,7 +13886,7 @@ __metadata:
languageName: node
linkType: hard

"jest-util@npm:^29.0.0, jest-util@npm:^29.7.0":
"jest-util@npm:^29.7.0":
version: 29.7.0
resolution: "jest-util@npm:29.7.0"
dependencies:
Expand Down Expand Up @@ -14654,7 +14645,7 @@ __metadata:
languageName: node
linkType: hard

"lodash.memoize@npm:4.x, lodash.memoize@npm:^4.1.2":
"lodash.memoize@npm:^4.1.2":
version: 4.1.2
resolution: "lodash.memoize@npm:4.1.2"
checksum: 9ff3942feeccffa4f1fafa88d32f0d24fdc62fd15ded5a74a5f950ff5f0c6f61916157246744c620173dddf38d37095a92327d5fd3861e2063e736a5c207d089
Expand Down Expand Up @@ -14848,7 +14839,7 @@ __metadata:
languageName: node
linkType: hard

"make-error@npm:1.x, make-error@npm:^1.1.1":
"make-error@npm:^1.1.1":
version: 1.3.6
resolution: "make-error@npm:1.3.6"
checksum: b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402
Expand Down Expand Up @@ -18307,6 +18298,8 @@ __metadata:
"@commitlint/cli": ^17.7.1
"@commitlint/config-conventional": ^17.7.0
"@faker-js/faker": ^8.1.0
"@swc/core": ^1.3.95
"@swc/jest": ^0.2.29
"@types/invariant": ^2.2.36
"@types/jest": ^29.5.5
"@types/node": ^20.6.2
Expand All @@ -18321,7 +18314,6 @@ __metadata:
prettier: ^3.0.3
react-native: 0.72.6
rimraf: ^5.0.1
ts-jest: ^29.1.1
ts-node: ^10.9.1
typescript: ^5.2.2
languageName: unknown
Expand Down Expand Up @@ -20833,39 +20825,6 @@ __metadata:
languageName: node
linkType: hard

"ts-jest@npm:^29.1.1":
version: 29.1.1
resolution: "ts-jest@npm:29.1.1"
dependencies:
bs-logger: 0.x
fast-json-stable-stringify: 2.x
jest-util: ^29.0.0
json5: ^2.2.3
lodash.memoize: 4.x
make-error: 1.x
semver: ^7.5.3
yargs-parser: ^21.0.1
peerDependencies:
"@babel/core": ">=7.0.0-beta.0 <8"
"@jest/types": ^29.0.0
babel-jest: ^29.0.0
jest: ^29.0.0
typescript: ">=4.3 <6"
peerDependenciesMeta:
"@babel/core":
optional: true
"@jest/types":
optional: true
babel-jest:
optional: true
esbuild:
optional: true
bin:
ts-jest: cli.js
checksum: a8c9e284ed4f819526749f6e4dc6421ec666f20ab44d31b0f02b4ed979975f7580b18aea4813172d43e39b29464a71899f8893dd29b06b4a351a3af8ba47b402
languageName: node
linkType: hard

"ts-node@npm:^10.8.1, ts-node@npm:^10.9.1":
version: 10.9.1
resolution: "ts-node@npm:10.9.1"
Expand Down Expand Up @@ -22322,7 +22281,7 @@ __metadata:
languageName: node
linkType: hard

"yargs-parser@npm:21.1.1, yargs-parser@npm:^21.0.1, yargs-parser@npm:^21.1.1":
"yargs-parser@npm:21.1.1, yargs-parser@npm:^21.1.1":
version: 21.1.1
resolution: "yargs-parser@npm:21.1.1"
checksum: ed2d96a616a9e3e1cc7d204c62ecc61f7aaab633dcbfab2c6df50f7f87b393993fe6640d017759fe112d0cb1e0119f2b4150a87305cc873fd90831c6a58ccf1c
Expand Down

2 comments on commit fcea8b9

@vercel
Copy link

@vercel vercel bot commented on fcea8b9 Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🔴 Statements 16.26% 329/2023
🔴 Branches 16.11% 82/509
🔴 Functions 11.02% 66/599
🔴 Lines 15.54% 299/1924

Test suite run success

83 tests passing in 10 suites.

Report generated by 🧪jest coverage report action from fcea8b9

Please sign in to comment.