Add swc transformer to make tests start faster

This commit is contained in:
Rory Powell 2023-07-18 21:15:44 +01:00
parent 4dc558d3e9
commit e7d304d4cf
3 changed files with 109 additions and 0 deletions

View File

@ -5,6 +5,9 @@ const config: Config.InitialOptions = {
setupFiles: ["./src/jest/jestSetup.ts"], setupFiles: ["./src/jest/jestSetup.ts"],
setupFilesAfterEnv: ["./src/jest/jest.extends.ts"], setupFilesAfterEnv: ["./src/jest/jest.extends.ts"],
testEnvironment: "node", testEnvironment: "node",
transform: {
"^.+\\.ts?$": "@swc/jest",
},
globalSetup: "./src/jest/globalSetup.ts", globalSetup: "./src/jest/globalSetup.ts",
globalTeardown: "./src/jest/globalTeardown.ts", globalTeardown: "./src/jest/globalTeardown.ts",
moduleNameMapper: { moduleNameMapper: {

View File

@ -30,6 +30,8 @@
"jest": "29.0.0", "jest": "29.0.0",
"prettier": "2.7.1", "prettier": "2.7.1",
"start-server-and-test": "1.14.0", "start-server-and-test": "1.14.0",
"@swc/core": "^1.3.25",
"@swc/jest": "^0.2.24",
"timekeeper": "2.2.0", "timekeeper": "2.2.0",
"ts-jest": "29.0.0", "ts-jest": "29.0.0",
"ts-node": "10.8.1", "ts-node": "10.8.1",

View File

@ -455,6 +455,13 @@
slash "^3.0.0" slash "^3.0.0"
strip-ansi "^6.0.0" strip-ansi "^6.0.0"
"@jest/create-cache-key-function@^27.4.2":
version "27.5.1"
resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-27.5.1.tgz#7448fae15602ea95c828f5eceed35c202a820b31"
integrity sha512-dmH1yW+makpTSURTy8VzdUwFnfQh1G8R+DxO2Ho2FFmBbKFEVm+3jWdvFhE2VqB/LATCTokkP0dotjyQyw5/AQ==
dependencies:
"@jest/types" "^27.5.1"
"@jest/environment@^29.5.0": "@jest/environment@^29.5.0":
version "29.5.0" version "29.5.0"
resolved "https://registry.npmjs.org/@jest/environment/-/environment-29.5.0.tgz" resolved "https://registry.npmjs.org/@jest/environment/-/environment-29.5.0.tgz"
@ -589,6 +596,17 @@
slash "^3.0.0" slash "^3.0.0"
write-file-atomic "^4.0.2" write-file-atomic "^4.0.2"
"@jest/types@^27.5.1":
version "27.5.1"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.5.1.tgz#3c79ec4a8ba61c170bf937bcf9e98a9df175ec80"
integrity sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==
dependencies:
"@types/istanbul-lib-coverage" "^2.0.0"
"@types/istanbul-reports" "^3.0.0"
"@types/node" "*"
"@types/yargs" "^16.0.0"
chalk "^4.0.0"
"@jest/types@^29.0.0", "@jest/types@^29.5.0": "@jest/types@^29.0.0", "@jest/types@^29.5.0":
version "29.5.0" version "29.5.0"
resolved "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz" resolved "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz"
@ -738,6 +756,80 @@
dependencies: dependencies:
"@sinonjs/commons" "^2.0.0" "@sinonjs/commons" "^2.0.0"
"@swc/core-darwin-arm64@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.70.tgz#056ac6899e22cb7f7be21388d4d938ca5123a72b"
integrity sha512-31+mcl0dgdRHvZRjhLOK9V6B+qJ7nxDZYINr9pBlqGWxknz37Vld5KK19Kpr79r0dXUZvaaelLjCnJk9dA2PcQ==
"@swc/core-darwin-x64@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.70.tgz#3945814de6fadbee5b46cb2a3422353acb420c5c"
integrity sha512-GMFJ65E18zQC80t0os+TZvI+8lbRuitncWVge/RXmXbVLPRcdykP4EJ87cqzcG5Ah0z18/E0T+ixD6jHRisrYQ==
"@swc/core-linux-arm-gnueabihf@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.70.tgz#7960e54ede1af75a7ef99ee53febf37fea6269a8"
integrity sha512-wjhCwS8LCiAq2VedF1b4Bryyw68xZnfMED4pLRazAl8BaUlDFANfRBORNunxlfHQj4V3x39IaiLgCZRHMdzXBg==
"@swc/core-linux-arm64-gnu@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.70.tgz#df9654e5040bbeb1619739756a7f50100e38ace8"
integrity sha512-9D/Rx67cAOnMiexvCqARxvhj7coRajTp5HlJHuf+rfwMqI2hLhpO9/pBMQxBUAWxODO/ksQ/OF+GJRjmtWw/2A==
"@swc/core-linux-arm64-musl@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.70.tgz#2c2aab5a136c7eb409ddc9cdc4f947a68fd74493"
integrity sha512-gkjxBio7XD+1GlQVVyPP/qeFkLu83VhRHXaUrkNYpr5UZG9zZurBERT9nkS6Y+ouYh+Q9xmw57aIyd2KvD2zqQ==
"@swc/core-linux-x64-gnu@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.70.tgz#774351532b154ed36a5c6d14b647e7a8ab510028"
integrity sha512-/nCly+V4xfMVwfEUoLLAukxUSot/RcSzsf6GdsGTjFcrp5sZIntAjokYRytm3VT1c2TK321AfBorsi9R5w8Y7Q==
"@swc/core-linux-x64-musl@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.70.tgz#c0b1b4ad5f4ef187eaa093589a4933ecb6836546"
integrity sha512-HoOsPJbt361KGKaivAK0qIiYARkhzlxeAfvF5NlnKxkIMOZpQ46Lwj3tR0VWohKbrhS+cYKFlVuDi5XnDkx0XA==
"@swc/core-win32-arm64-msvc@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.70.tgz#8640267ce3959db0e7e682103677a5e0500b5ea7"
integrity sha512-hm4IBK/IaRil+aj1cWU6f0GyAdHpw/Jr5nyFYLM2c/tt7w2t5hgb8NjzM2iM84lOClrig1fG6edj2vCF1dFzNQ==
"@swc/core-win32-ia32-msvc@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.70.tgz#f95d5656622f5a963bc0125da9fda84cf40faa8d"
integrity sha512-5cgKUKIT/9Fp5fCA+zIjYCQ4dSvjFYOeWGZR3QiTXGkC4bGa1Ji9SEPyeIAX0iruUnKjYaZB9RvHK2tNn7RLrQ==
"@swc/core-win32-x64-msvc@1.3.70":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.70.tgz#5b3acddb96fdf60df089b837061915cb4be94eaa"
integrity sha512-LE8lW46+TQBzVkn2mHBlk8DIElPIZ2dO5P8AbJiARNBAnlqQWu67l9gWM89UiZ2l33J2cI37pHzON3tKnT8f9g==
"@swc/core@^1.3.25":
version "1.3.70"
resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.70.tgz#f5ddc6fe6add7a99f5b94d2214ad0d8527d11479"
integrity sha512-LWVWlEDLlOD25PvA2NEz41UzdwXnlDyBiZbe69s3zM0DfCPwZXLUm79uSqH9ItsOjTrXSL5/1+XUL6C/BZwChA==
optionalDependencies:
"@swc/core-darwin-arm64" "1.3.70"
"@swc/core-darwin-x64" "1.3.70"
"@swc/core-linux-arm-gnueabihf" "1.3.70"
"@swc/core-linux-arm64-gnu" "1.3.70"
"@swc/core-linux-arm64-musl" "1.3.70"
"@swc/core-linux-x64-gnu" "1.3.70"
"@swc/core-linux-x64-musl" "1.3.70"
"@swc/core-win32-arm64-msvc" "1.3.70"
"@swc/core-win32-ia32-msvc" "1.3.70"
"@swc/core-win32-x64-msvc" "1.3.70"
"@swc/jest@^0.2.24":
version "0.2.26"
resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.26.tgz#6ef2d6d31869e3aaddc132603bc21f2e4c57cc5d"
integrity sha512-7lAi7q7ShTO3E5Gt1Xqf3pIhRbERxR1DUxvtVa9WKzIB+HGQ7wZP5sYx86zqnaEoKKGhmOoZ7gyW0IRu8Br5+A==
dependencies:
"@jest/create-cache-key-function" "^27.4.2"
jsonc-parser "^3.2.0"
"@techpass/passport-openidconnect@0.3.2": "@techpass/passport-openidconnect@0.3.2":
version "0.3.2" version "0.3.2"
resolved "https://registry.npmjs.org/@techpass/passport-openidconnect/-/passport-openidconnect-0.3.2.tgz" resolved "https://registry.npmjs.org/@techpass/passport-openidconnect/-/passport-openidconnect-0.3.2.tgz"
@ -885,6 +977,13 @@
resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz"
integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==
"@types/yargs@^16.0.0":
version "16.0.5"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.5.tgz#12cc86393985735a283e387936398c2f9e5f88e3"
integrity sha512-AxO/ADJOBFJScHbWhq2xAhlWP24rY4aCEG/NFaMvbT3X2MgRsLjhjQwsn0Zi5zn0LG9jUhCCZMeX9Dkuw6k+vQ==
dependencies:
"@types/yargs-parser" "*"
"@types/yargs@^17.0.8": "@types/yargs@^17.0.8":
version "17.0.22" version "17.0.22"
resolved "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz" resolved "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz"
@ -2866,6 +2965,11 @@ json5@^2.2.1, json5@^2.2.2:
resolved "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz" resolved "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
jsonc-parser@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76"
integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==
jsonwebtoken@9.0.0: jsonwebtoken@9.0.0:
version "9.0.0" version "9.0.0"
resolved "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz" resolved "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz"