chore: switch to swc/jest to speed up tests

wip-related-pages
sebastien.arod@gmail.com 2024-06-04 21:42:40 +02:00
parent 74f3390413
commit 88cc76bcce
4 changed files with 171 additions and 60 deletions

View File

@ -4,10 +4,9 @@ const config: Config = {
collectCoverage: true, collectCoverage: true,
coverageDirectory: "../test-coverage", coverageDirectory: "../test-coverage",
coverageProvider: "v8", coverageProvider: "v8",
preset: "ts-jest/presets/default-esm",
testEnvironment: "jest-environment-node", testEnvironment: "jest-environment-node",
transform: { transform: {
"^.+\\.m?[t]s?$": ["ts-jest", { useESM: true }], "^.+\\.m?[t]s?$": ["@swc/jest", {}],
}, },
rootDir: "src", rootDir: "src",
}; };

View File

@ -8,6 +8,8 @@
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.3.0", "@eslint/js": "^9.3.0",
"@jest/globals": "^29.7.0", "@jest/globals": "^29.7.0",
"@swc/core": "^1.5.24",
"@swc/jest": "^0.2.36",
"@types/node": "^20.12.12", "@types/node": "^20.12.12",
"eslint": "9.x", "eslint": "9.x",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
@ -16,7 +18,6 @@
"jest": "^29.7.0", "jest": "^29.7.0",
"lint-staged": "^15.2.5", "lint-staged": "^15.2.5",
"prettier": "^2.8.4", "prettier": "^2.8.4",
"ts-jest": "^29.1.4",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.4.5", "typescript": "^5.4.5",
"typescript-eslint": "^7.11.0" "typescript-eslint": "^7.11.0"

View File

@ -7,6 +7,7 @@
"rootDir": "src", "rootDir": "src",
"outDir": "dist", "outDir": "dist",
"esModuleInterop": true, "esModuleInterop": true,
"isolatedModules": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"strict": true, "strict": true,
"skipLibCheck": true, "skipLibCheck": true,

224
yarn.lock
View File

@ -580,6 +580,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@jest/create-cache-key-function@npm:^29.7.0":
version: 29.7.0
resolution: "@jest/create-cache-key-function@npm:29.7.0"
dependencies:
"@jest/types": "npm:^29.6.3"
checksum: 10c0/5c47ef62205264adf77b1ff26b969ce9fe84920b8275c3c5e83f4236859d6ae5e4e7027af99eef04a8e334c4e424d44af3e167972083406070aca733ac2a2795
languageName: node
linkType: hard
"@jest/environment@npm:^29.7.0": "@jest/environment@npm:^29.7.0":
version: 29.7.0 version: 29.7.0
resolution: "@jest/environment@npm:29.7.0" resolution: "@jest/environment@npm:29.7.0"
@ -898,6 +907,151 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-darwin-arm64@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-darwin-arm64@npm:1.5.24"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard
"@swc/core-darwin-x64@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-darwin-x64@npm:1.5.24"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard
"@swc/core-linux-arm-gnueabihf@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.5.24"
conditions: os=linux & cpu=arm
languageName: node
linkType: hard
"@swc/core-linux-arm64-gnu@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-linux-arm64-gnu@npm:1.5.24"
conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node
linkType: hard
"@swc/core-linux-arm64-musl@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-linux-arm64-musl@npm:1.5.24"
conditions: os=linux & cpu=arm64 & libc=musl
languageName: node
linkType: hard
"@swc/core-linux-x64-gnu@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-linux-x64-gnu@npm:1.5.24"
conditions: os=linux & cpu=x64 & libc=glibc
languageName: node
linkType: hard
"@swc/core-linux-x64-musl@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-linux-x64-musl@npm:1.5.24"
conditions: os=linux & cpu=x64 & libc=musl
languageName: node
linkType: hard
"@swc/core-win32-arm64-msvc@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-win32-arm64-msvc@npm:1.5.24"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard
"@swc/core-win32-ia32-msvc@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-win32-ia32-msvc@npm:1.5.24"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard
"@swc/core-win32-x64-msvc@npm:1.5.24":
version: 1.5.24
resolution: "@swc/core-win32-x64-msvc@npm:1.5.24"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
"@swc/core@npm:^1.5.24":
version: 1.5.24
resolution: "@swc/core@npm:1.5.24"
dependencies:
"@swc/core-darwin-arm64": "npm:1.5.24"
"@swc/core-darwin-x64": "npm:1.5.24"
"@swc/core-linux-arm-gnueabihf": "npm:1.5.24"
"@swc/core-linux-arm64-gnu": "npm:1.5.24"
"@swc/core-linux-arm64-musl": "npm:1.5.24"
"@swc/core-linux-x64-gnu": "npm:1.5.24"
"@swc/core-linux-x64-musl": "npm:1.5.24"
"@swc/core-win32-arm64-msvc": "npm:1.5.24"
"@swc/core-win32-ia32-msvc": "npm:1.5.24"
"@swc/core-win32-x64-msvc": "npm:1.5.24"
"@swc/counter": "npm:^0.1.3"
"@swc/types": "npm:^0.1.7"
peerDependencies:
"@swc/helpers": "*"
dependenciesMeta:
"@swc/core-darwin-arm64":
optional: true
"@swc/core-darwin-x64":
optional: true
"@swc/core-linux-arm-gnueabihf":
optional: true
"@swc/core-linux-arm64-gnu":
optional: true
"@swc/core-linux-arm64-musl":
optional: true
"@swc/core-linux-x64-gnu":
optional: true
"@swc/core-linux-x64-musl":
optional: true
"@swc/core-win32-arm64-msvc":
optional: true
"@swc/core-win32-ia32-msvc":
optional: true
"@swc/core-win32-x64-msvc":
optional: true
peerDependenciesMeta:
"@swc/helpers":
optional: true
checksum: 10c0/7deec75ff91132bd5c3382760f20fa8e8f7ee56f95b52510a863c199f25dba9493da569d4278cec9bcea557b867993237a688a95b125d3ec19289290022e96d4
languageName: node
linkType: hard
"@swc/counter@npm:^0.1.3":
version: 0.1.3
resolution: "@swc/counter@npm:0.1.3"
checksum: 10c0/8424f60f6bf8694cfd2a9bca45845bce29f26105cda8cf19cdb9fd3e78dc6338699e4db77a89ae449260bafa1cc6bec307e81e7fb96dbf7dcfce0eea55151356
languageName: node
linkType: hard
"@swc/jest@npm:^0.2.36":
version: 0.2.36
resolution: "@swc/jest@npm:0.2.36"
dependencies:
"@jest/create-cache-key-function": "npm:^29.7.0"
"@swc/counter": "npm:^0.1.3"
jsonc-parser: "npm:^3.2.0"
peerDependencies:
"@swc/core": "*"
checksum: 10c0/7f1993f9201420bb499c92ab28797352bcbf9e3a6c7b5a1806fdc34c9c3b46ea9e5b2f070c0e13fcf7f3c3fadbbc38777840baabb178f589bf1f67543763adb6
languageName: node
linkType: hard
"@swc/types@npm:^0.1.7":
version: 0.1.7
resolution: "@swc/types@npm:0.1.7"
dependencies:
"@swc/counter": "npm:^0.1.3"
checksum: 10c0/da7c542de0a44b85a98139db03920448e86309d28ad9e9335f91b4025e5f32ae4fbbfdd0f287330fb0de737e7c5ec4f64ade0fc5fffea6c2fd9ac681b1e97bea
languageName: node
linkType: hard
"@tsconfig/node10@npm:^1.0.7": "@tsconfig/node10@npm:^1.0.7":
version: 1.0.11 version: 1.0.11
resolution: "@tsconfig/node10@npm:1.0.11" resolution: "@tsconfig/node10@npm:1.0.11"
@ -1458,15 +1612,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"bs-logger@npm:0.x":
version: 0.2.6
resolution: "bs-logger@npm:0.2.6"
dependencies:
fast-json-stable-stringify: "npm:2.x"
checksum: 10c0/80e89aaaed4b68e3374ce936f2eb097456a0dddbf11f75238dbd53140b1e39259f0d248a5089ed456f1158984f22191c3658d54a713982f676709fbe1a6fa5a0
languageName: node
linkType: hard
"bser@npm:2.1.1": "bser@npm:2.1.1":
version: 2.1.1 version: 2.1.1
resolution: "bser@npm:2.1.1" resolution: "bser@npm:2.1.1"
@ -2146,7 +2291,7 @@ __metadata:
languageName: node languageName: node
linkType: hard 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 version: 2.1.0
resolution: "fast-json-stable-stringify@npm:2.1.0" resolution: "fast-json-stable-stringify@npm:2.1.0"
checksum: 10c0/7f081eb0b8a64e0057b3bb03f974b3ef00135fbf36c1c710895cd9300f13c94ba809bb3a81cf4e1b03f6e5285610a61abbd7602d0652de423144dfee5a389c9b checksum: 10c0/7f081eb0b8a64e0057b3bb03f974b3ef00135fbf36c1c710895cd9300f13c94ba809bb3a81cf4e1b03f6e5285610a61abbd7602d0652de423144dfee5a389c9b
@ -3155,7 +3300,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"jest-util@npm:^29.0.0, jest-util@npm:^29.7.0": "jest-util@npm:^29.7.0":
version: 29.7.0 version: 29.7.0
resolution: "jest-util@npm:29.7.0" resolution: "jest-util@npm:29.7.0"
dependencies: dependencies:
@ -3313,6 +3458,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"jsonc-parser@npm:^3.2.0":
version: 3.2.1
resolution: "jsonc-parser@npm:3.2.1"
checksum: 10c0/ada66dec143d7f9cb0e2d0d29c69e9ce40d20f3a4cb96b0c6efb745025ac7f9ba647d7ac0990d0adfc37a2d2ae084a12009a9c833dbdbeadf648879a99b9df89
languageName: node
linkType: hard
"keyv@npm:^4.5.4": "keyv@npm:^4.5.4":
version: 4.5.4 version: 4.5.4
resolution: "keyv@npm:4.5.4" resolution: "keyv@npm:4.5.4"
@ -3412,13 +3564,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"lodash.memoize@npm:4.x":
version: 4.1.2
resolution: "lodash.memoize@npm:4.1.2"
checksum: 10c0/c8713e51eccc650422716a14cece1809cfe34bc5ab5e242b7f8b4e2241c2483697b971a604252807689b9dd69bfe3a98852e19a5b89d506b000b4187a1285df8
languageName: node
linkType: hard
"lodash.merge@npm:^4.6.2": "lodash.merge@npm:^4.6.2":
version: 4.6.2 version: 4.6.2
resolution: "lodash.merge@npm:4.6.2" resolution: "lodash.merge@npm:4.6.2"
@ -3464,7 +3609,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"make-error@npm:1.x, make-error@npm:^1.1.1": "make-error@npm:^1.1.1":
version: 1.3.6 version: 1.3.6
resolution: "make-error@npm:1.3.6" resolution: "make-error@npm:1.3.6"
checksum: 10c0/171e458d86854c6b3fc46610cfacf0b45149ba043782558c6875d9f42f222124384ad0b468c92e996d815a8a2003817a710c0a160e49c1c394626f76fa45396f checksum: 10c0/171e458d86854c6b3fc46610cfacf0b45149ba043782558c6875d9f42f222124384ad0b468c92e996d815a8a2003817a710c0a160e49c1c394626f76fa45396f
@ -4340,6 +4485,8 @@ __metadata:
"@eslint/js": "npm:^9.3.0" "@eslint/js": "npm:^9.3.0"
"@jest/globals": "npm:^29.7.0" "@jest/globals": "npm:^29.7.0"
"@notionhq/client": "npm:^2.2.14" "@notionhq/client": "npm:^2.2.14"
"@swc/core": "npm:^1.5.24"
"@swc/jest": "npm:^0.2.36"
"@types/node": "npm:^20.12.12" "@types/node": "npm:^20.12.12"
date-fns: "npm:^3.6.0" date-fns: "npm:^3.6.0"
eslint: "npm:9.x" eslint: "npm:9.x"
@ -4349,7 +4496,6 @@ __metadata:
jest: "npm:^29.7.0" jest: "npm:^29.7.0"
lint-staged: "npm:^15.2.5" lint-staged: "npm:^15.2.5"
prettier: "npm:^2.8.4" prettier: "npm:^2.8.4"
ts-jest: "npm:^29.1.4"
ts-node: "npm:^10.9.2" ts-node: "npm:^10.9.2"
typescript: "npm:^5.4.5" typescript: "npm:^5.4.5"
typescript-eslint: "npm:^7.11.0" typescript-eslint: "npm:^7.11.0"
@ -4557,42 +4703,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"ts-jest@npm:^29.1.4":
version: 29.1.4
resolution: "ts-jest@npm:29.1.4"
dependencies:
bs-logger: "npm:0.x"
fast-json-stable-stringify: "npm:2.x"
jest-util: "npm:^29.0.0"
json5: "npm:^2.2.3"
lodash.memoize: "npm:4.x"
make-error: "npm:1.x"
semver: "npm:^7.5.3"
yargs-parser: "npm:^21.0.1"
peerDependencies:
"@babel/core": ">=7.0.0-beta.0 <8"
"@jest/transform": ^29.0.0
"@jest/types": ^29.0.0
babel-jest: ^29.0.0
jest: ^29.0.0
typescript: ">=4.3 <6"
peerDependenciesMeta:
"@babel/core":
optional: true
"@jest/transform":
optional: true
"@jest/types":
optional: true
babel-jest:
optional: true
esbuild:
optional: true
bin:
ts-jest: cli.js
checksum: 10c0/97def10be26a553e529dfacafe264fa9833d638052bc2b1ebe6301262ae2d3e43954f4d91f2d2d07cf92352cdd4fa163a86f8116a1f6bb8cef7060cddfec794b
languageName: node
linkType: hard
"ts-node@npm:^10.9.2": "ts-node@npm:^10.9.2":
version: 10.9.2 version: 10.9.2
resolution: "ts-node@npm:10.9.2" resolution: "ts-node@npm:10.9.2"
@ -4891,7 +5001,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"yargs-parser@npm:^21.0.1, yargs-parser@npm:^21.1.1": "yargs-parser@npm:^21.1.1":
version: 21.1.1 version: 21.1.1
resolution: "yargs-parser@npm:21.1.1" resolution: "yargs-parser@npm:21.1.1"
checksum: 10c0/f84b5e48169479d2f402239c59f084cfd1c3acc197a05c59b98bab067452e6b3ea46d4dd8ba2985ba7b3d32a343d77df0debd6b343e5dae3da2aab2cdf5886b2 checksum: 10c0/f84b5e48169479d2f402239c59f084cfd1c3acc197a05c59b98bab067452e6b3ea46d4dd8ba2985ba7b3d32a343d77df0debd6b343e5dae3da2aab2cdf5886b2