Use @swc/jest as Jest transformer (#688)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Mathis Møller · committed by GitHub · parent 30f5505 · Browse files · 4 files·+143 added−0 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+143 added−0 removed
- other:+143 added−0 removed
Provenance
- Commit
c8243e5- Tree
c36ae4e- Author
Mathis Møller <mmm@cryosinternational.com>- Committer
GitHub <noreply@github.com>- Parent
30f5505
4 files changed+143 added−0 removed
modified:.github/workflows/test-multiple-versions.yml+1 added
50 unmodified lines51525354555657585950 unmodified lines if: ${{ startsWith(matrix.react, '16.') }} run: | sed -i~ '1s/^/import React from "react";/' tests/*.tsx sed -i~ 's/automatic/classic/' babel.config.js sed -i~ 's/automatic/classic/' .swcrc - name: Test ${{ matrix.react }} run: | yarn add -D react@${{ matrix.react }} react-dom@${{ matrix.react }} yarn test:ciadded:.swcrc+18 added
1+{2+ "jsc": {3+ "target": "es5",4+ "parser": {5+ "syntax": "typescript",6+ "tsx": true7+ },8+ "transform": {9+ "react": {10+ "runtime": "automatic",11+ "pragma": "React.createElement",12+ "pragmaFrag": "React.Fragment",13+ "throwIfNamespace": true,14+ "useBuiltins": true15+ }16+ }17+ }18+}modified:package.json+7 added
99 unmodified lines100 "homepage": "https://github.com/pmndrs/zustand",101 "jest": {102 "rootDir": ".",103 "testEnvironment": "jsdom",104+ "transform": {105+ "^.+\\.(t|j)sx?$": [106+ "@swc/jest"107+ ]108+ },109 "moduleNameMapper": {110 "^zustand$": "<rootDir>/src/index.ts",111 "^zustand/(.*)$": "<rootDir>/src/$1.ts"112 },23 unmodified lines136 "@babel/preset-env": "^7.16.4",137 "@rollup/plugin-babel": "^5.3.0",138 "@rollup/plugin-node-resolve": "^13.0.6",139 "@rollup/plugin-typescript": "^8.3.0",140+ "@swc/core": "^1.2.115",141+ "@swc/jest": "^0.2.11",142 "@testing-library/react": "^12.1.2",143 "@types/jest": "^27.0.3",144 "@types/react": "^17.0.35",145 "@types/react-dom": "^17.0.11",34 unmodified linesmodified:yarn.lock+117 added
1037 unmodified lines1038 rimraf "^3.0.0"1039 slash "^3.0.0"1040 strip-ansi "^6.0.0"1041 1042+"@jest/create-cache-key-function@^27.3.1":1043+ version "27.4.2"1044+ resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-27.4.2.tgz#09b585f9dbafec0f56cfb0e4d4edfe2bec0e0768"1045+ integrity sha512-aSSCAJwUNX4R1hJQoyimsND5l+2EsFgzlepS8NuOJJHjXij/UdxYFngac44tmv9IYdI+kglAyORg0plt4/aFMQ==1046+ dependencies:1047+ "@jest/types" "^27.4.2"1048+1049 "@jest/environment@^27.3.1":1050 version "27.3.1"1051 resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.3.1.tgz#2182defbce8d385fd51c5e7c7050f510bd4c86b1"1052 integrity sha512-BCKCj4mOVLme6Tanoyc9k0ultp3pnmuyHw73UHRPeeZxirsU/7E3HC4le/VDb/SMzE1JcPnto+XBKFOcoiJzVw==115 unmodified lines1168 "@types/node" "*"1169 "@types/yargs" "^16.0.0"1170 chalk "^4.0.0"1171 1172+"@jest/types@^27.4.2":1173+ version "27.4.2"1174+ resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.4.2.tgz#96536ebd34da6392c2b7c7737d693885b5dd44a5"1175+ integrity sha512-j35yw0PMTPpZsUoOBiuHzr1zTYoad1cVIE0ajEjcrJONxxrko/IRGKkXx3os0Nsi4Hu3+5VmDbVfq5WhG/pWAg==1176+ dependencies:1177+ "@types/istanbul-lib-coverage" "^2.0.0"1178+ "@types/istanbul-reports" "^3.0.0"1179+ "@types/node" "*"1180+ "@types/yargs" "^16.0.0"1181+ chalk "^4.0.0"1182+1183+"@napi-rs/triples@^1.0.3":1184+ version "1.0.3"1185+ resolved "https://registry.yarnpkg.com/@napi-rs/triples/-/triples-1.0.3.tgz#76d6d0c3f4d16013c61e45dfca5ff1e6c31ae53c"1186+ integrity sha512-jDJTpta+P4p1NZTFVLHJ/TLFVYVcOqv6l8xwOeBKNPMgY/zDYH/YH7SJbvrr/h1RcS9GzbPcLKGzpuK9cV56UA==1187+1188+"@node-rs/helper@^1.0.0":1189+ version "1.2.1"1190+ resolved "https://registry.yarnpkg.com/@node-rs/helper/-/helper-1.2.1.tgz#e079b05f21ff4329d82c4e1f71c0290e4ecdc70c"1191+ integrity sha512-R5wEmm8nbuQU0YGGmYVjEc0OHtYsuXdpRG+Ut/3wZ9XAvQWyThN08bTh2cBJgoZxHQUPtvRfeQuxcAgLuiBISg==1192+ dependencies:1193+ "@napi-rs/triples" "^1.0.3"1194+1195 "@nodelib/fs.scandir@2.1.5":1196 version "2.1.5"1197 resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"1198 integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==72 unmodified lines1271 integrity sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==1272 dependencies:1273 "@sinonjs/commons" "^1.7.0"1274 1275+"@swc/core-android-arm64@^1.2.115":1276+ version "1.2.115"1277+ resolved "https://registry.yarnpkg.com/@swc/core-android-arm64/-/core-android-arm64-1.2.115.tgz#f4c3a464bb28e9da1e1154f0719ed8b2cea2af83"1278+ integrity sha512-gFR5WloJC2/5J4qqxgXsDaBq86EQdBF+gxZ7YlksI34uMkcPeTUwY+i2+90oLJ9wKokxA+ZSinHSDhnoZcj17g==1279+1280+"@swc/core-darwin-arm64@^1.2.115":1281+ version "1.2.115"1282+ resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.115.tgz#30cbf6f4a2d2fb6d68df0de63fc90a7e5651b5d5"1283+ integrity sha512-NAV8hWQ/9nCFL7gZtloj4GIj49HxNqzAONtILXVmJdpoMJCsa0I5JQqcYApj9TqJdsHWf5mKM2inlb547pJcbA==1284+1285+"@swc/core-darwin-x64@^1.2.115":1286+ version "1.2.115"1287+ resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.2.115.tgz#11cfd0539519fbae794f4a87a38c782da447116c"1288+ integrity sha512-y1ZkBkDIF1Fp5SnFLMiERCTp6FTzdVqopNLSmCWnm5x+FtMxr/GI4408VcwzgwpT19zRevtoPPtr/oFYhfRGAg==1289+1290+"@swc/core-freebsd-x64@^1.2.115":1291+ version "1.2.115"1292+ resolved "https://registry.yarnpkg.com/@swc/core-freebsd-x64/-/core-freebsd-x64-1.2.115.tgz#05f4c07d9bace093abce92c43602ed2d7145dfb0"1293+ integrity sha512-KuQfiX/9eSbGT7udkZreJSLWkxkHxlUUJBjGE9Y9LMeETZnpH85fpUuOQdYWQENzBVilCTW4vrHasaVJAG1Y0A==1294+1295+"@swc/core-linux-arm-gnueabihf@^1.2.115":1296+ version "1.2.115"1297+ resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.115.tgz#22057192258a5b89dd878b8a92b19c7c9249d25f"1298+ integrity sha512-NkflRvji0heBMigLgnRkb1tgnnfTcIreiPuvDekXdBv2TSry9sHxiOgB2J1m/jVN2dqzEAmBVi/Qi9093vNPRQ==1299+1300+"@swc/core-linux-arm64-gnu@^1.2.115":1301+ version "1.2.115"1302+ resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.115.tgz#824b6c12ce897c4554c693e05740a1f1a061cdd4"1303+ integrity sha512-yL/xgVbgdViku1FBMBj0bsLigcP4m09tpXsDhexkb8PWZ+uwHvTaXvm5aR+9xzRgct+lgrw9unbawvnHHDDBsA==1304+1305+"@swc/core-linux-arm64-musl@^1.2.115":1306+ version "1.2.115"1307+ resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.2.115.tgz#0b8fce32f8271c1c8e324f5e089aaed503bfad06"1308+ integrity sha512-1Zzyxg6WUI78dc/e5bcYZjwRYAVc6icg7iZmcqb/t7cYWKebjOucIHH4kI9fzPphduA5kkLsXvQmtbh4jn6ZWA==1309+1310+"@swc/core-linux-x64-gnu@^1.2.115":1311+ version "1.2.115"1312+ resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.115.tgz#be7580b088514fb637b45f538832b96c8b7d137e"1313+ integrity sha512-WqWBbUupsE7xVbVuOlv9yBZAlsYgflDVhtovTQYEVPW0ye3Q9tgnw9f9vRm+NANfqwGztPaDhWWQcPfF6PrLPQ==1314+1315+"@swc/core-linux-x64-musl@^1.2.115":1316+ version "1.2.115"1317+ resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.115.tgz#e74fd6f41f004223406888a4a7480a8656f90a7d"1318+ integrity sha512-ot/DRxAk/Bez91vFWSbqHcua4a531vCaLw1Obcf4X05UfBbKZyFfic5Z0dnP+Gj/J6/BMd8Mga/b60i/Ox5UsA==1319+1320+"@swc/core-win32-arm64-msvc@^1.2.115":1321+ version "1.2.115"1322+ resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.2.115.tgz#e3ffab4028a603aaf39b9edfd76f3c17ec23b579"1323+ integrity sha512-TQFBdAo8ebxvkpHYnu0Emb80FeMA9xjMxrTgD9cq2q2HjUU7sDlurKNnkaEf5/Utu8hRmP/XVM3EDDifHJEjhw==1324+1325+"@swc/core-win32-ia32-msvc@^1.2.115":1326+ version "1.2.115"1327+ resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.115.tgz#885685f60b3ec7d40fa4ade79e9ac6a520c3bda7"1328+ integrity sha512-XohgeaIUOnE+WU5g2EAJ4MkaqNEGIMTKI459z/7uVObXAg8Zwk0GRqFH2hyQCge/ts8rSSJYB9N60OLGHPI2mg==1329+1330+"@swc/core-win32-x64-msvc@^1.2.115":1331+ version "1.2.115"1332+ resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.115.tgz#96233925499bf050eb785b54a4c17ae3dab95a08"1333+ integrity sha512-8qYZefGpua06monfbfpV/zJ3onxI2862HfjMTI3DaaR+v76bBbtrnX40fRtsIVTq0wYFf2uw+sdXOtXemipekA==1334+1335+"@swc/core@^1.2.115":1336+ version "1.2.115"1337+ resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.2.115.tgz#5815e913ce81668cc0283936011a7dbf72f9bc96"1338+ integrity sha512-2CfrraHNVIYSP5zLjrIW3Ofa5dvROCl3QXv3JtgAVm5AMaDIy9TjClexuB3+vDeHiZ+PPHZ8PCYsTfiWs3lJmg==1339+ dependencies:1340+ "@node-rs/helper" "^1.0.0"1341+ optionalDependencies:1342+ "@swc/core-android-arm64" "^1.2.115"1343+ "@swc/core-darwin-arm64" "^1.2.115"1344+ "@swc/core-darwin-x64" "^1.2.115"1345+ "@swc/core-freebsd-x64" "^1.2.115"1346+ "@swc/core-linux-arm-gnueabihf" "^1.2.115"1347+ "@swc/core-linux-arm64-gnu" "^1.2.115"1348+ "@swc/core-linux-arm64-musl" "^1.2.115"1349+ "@swc/core-linux-x64-gnu" "^1.2.115"1350+ "@swc/core-linux-x64-musl" "^1.2.115"1351+ "@swc/core-win32-arm64-msvc" "^1.2.115"1352+ "@swc/core-win32-ia32-msvc" "^1.2.115"1353+ "@swc/core-win32-x64-msvc" "^1.2.115"1354+1355+"@swc/jest@^0.2.11":1356+ version "0.2.11"1357+ resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.11.tgz#4e9f158747e61da556c46dc0b213f926b94b2068"1358+ integrity sha512-2iYyhP3W6Kffs9bKHmrcALT2/SPIqfLlG8jPXvtNFvjIbapC+ChnqaqEl1rSm/iA8xk3xkhYLubohtGtNBWAmw==1359+ dependencies:1360+ "@jest/create-cache-key-function" "^27.3.1"1361+1362 "@testing-library/dom@^8.0.0":1363 version "8.11.1"1364 resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.11.1.tgz#03fa2684aa09ade589b460db46b4c7be9fc69753"1365 integrity sha512-3KQDyx9r0RKYailW2MiYrSSKEfH0GTkI51UGEvJenvcoDoeRYs0PZpi2SXqtnMClQvCqdtTTpOfFETDTVADpAg==3806 unmodified lines