feat(core): use faster swc-jest

This commit is contained in:
HerringtonDarkholme 2020-07-30 23:27:08 +08:00 committed by jeremywu
parent 55afacad18
commit 8d8bff8030
3 changed files with 58 additions and 50 deletions

View File

@ -1,5 +1,4 @@
module.exports = {
preset: 'ts-jest',
globals: {
// work around: https://github.com/kulshekhar/ts-jest/issues/748#issuecomment-423528659
'ts-jest': {
@ -11,6 +10,7 @@ module.exports = {
testEnvironment: 'jsdom',
transform: {
'^.+\\.vue$': 'vue-jest',
'^.+\\.(t|j)sx?$': ['@swc-node/jest'],
},
moduleFileExtensions: ['vue', 'json', 'ts', 'tsx', 'js', 'json'],
}

View File

@ -20,6 +20,7 @@
"@commitlint/config-conventional": "^9.1.1",
"@storybook/addon-storysource": "^5.3.19",
"@storybook/html": "^5.3.19",
"@swc-node/jest": "^0.1.7",
"@types/jest": "^26.0.7",
"@types/lodash-es": "^4.17.3",
"@typescript-eslint/eslint-plugin": "^3.7.0",
@ -34,7 +35,6 @@
"jest": "^24.1.0",
"lerna": "^3.22.1",
"lint-staged": "^10.2.11",
"ts-jest": "^26.1.3",
"ts-loader": "^8.0.1",
"typescript": "^3.9.7",
"vite": "^1.0.0-rc.1",

104
yarn.lock
View File

@ -1279,16 +1279,6 @@
"@types/yargs" "^15.0.0"
chalk "^3.0.0"
"@jest/types@^26.1.0":
version "26.1.0"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.1.0.tgz#f8afaaaeeb23b5cad49dd1f7779689941dcb6057"
integrity sha512-GXigDDsp6ZlNMhXQDeuy/iYCDsRIHJabWtDzvnn36+aqFfG14JmFV0e/iXxY4SP9vbXSiPNOWdehU5MeqrYHBQ==
dependencies:
"@types/istanbul-lib-coverage" "^2.0.0"
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^15.0.0"
chalk "^4.0.0"
"@lerna/add@3.21.0":
version "3.21.0"
resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.21.0.tgz#27007bde71cc7b0a2969ab3c2f0ae41578b4577b"
@ -1982,6 +1972,13 @@
call-me-maybe "^1.0.1"
glob-to-regexp "^0.3.0"
"@node-rs/helper@^0.2.1":
version "0.2.1"
resolved "https://registry.yarnpkg.com/@node-rs/helper/-/helper-0.2.1.tgz#6bbd9023301a68a2717111e99c41ef38e3fa0726"
integrity sha512-DEPYwfkkhJlVLFu6hWVGZi96jUCBahi1WoHZAC7gSFoeoJtxwJ+FrJSDx/8c9aIwAf477NnKj8bRJzFm98Me3A==
dependencies:
tslib "^2.0.0"
"@nodelib/fs.scandir@2.1.3":
version "2.1.3"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b"
@ -2510,6 +2507,39 @@
telejson "^3.2.0"
util-deprecate "^1.0.2"
"@swc-node/core-darwin@^0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@swc-node/core-darwin/-/core-darwin-0.1.7.tgz#8723f2cecac645726a8428d3ab46872361dd88d4"
integrity sha512-cPIjtuciMVNPAk8tyLmCGw/omWJkSa9fpZvsKn1wb/teGyRvVaxchzZD9EfTsd8z+t2XUMh0FQ8Bn4FdEWz8lA==
"@swc-node/core-linux@^0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@swc-node/core-linux/-/core-linux-0.1.7.tgz#ca55aa935484759f8d6a91a929701d30df49ce9c"
integrity sha512-Gm7vDqJ/p3J3G8L7Ml2lehfpydhl9i5ADBZ9NXPMURb7HkVCZZi37R4DdQ3JXKathWwQ8aUqOvzy7ccDD6EJJQ==
"@swc-node/core-win32@^0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@swc-node/core-win32/-/core-win32-0.1.7.tgz#8a2c85a0a781f0a5537914b1a01e32e9d9e535d6"
integrity sha512-m6PDok3Ysv9PQjvrG+KdhVS01j+LvYuqW05fFlvvYz8xIQiUrls45Gqw7u9oyv54mQqFp3an1q2C0mIQC7iR4g==
"@swc-node/core@^0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@swc-node/core/-/core-0.1.7.tgz#72b9a44e5a43ba1dc20b260dc15472ca6e891516"
integrity sha512-TP0fRxG4lztOOl0neLFdsbgm+Aed78cRSm+mCw8UPLMo6SF4t5zdL60iBgtHPTYTfzQ710ZIDyzy2LDyRFA6rw==
dependencies:
"@node-rs/helper" "^0.2.1"
optionalDependencies:
"@swc-node/core-darwin" "^0.1.7"
"@swc-node/core-linux" "^0.1.7"
"@swc-node/core-win32" "^0.1.7"
"@swc-node/jest@^0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@swc-node/jest/-/jest-0.1.7.tgz#b90612e40d05dfd8d069d401b7950f81edc070ea"
integrity sha512-eZ41Gzhza72hor/E4bnIa0Z/AZO1SjymBwygQzjrgj6uon8epuBELEfhhzgm3RSaEbHBk6QotBwJUqMS+Hyvtg==
dependencies:
"@swc-node/core" "^0.1.7"
"@types/accepts@*":
version "1.3.5"
resolved "https://registry.yarnpkg.com/@types/accepts/-/accepts-1.3.5.tgz#c34bec115cfc746e04fe5a059df4ce7e7b391575"
@ -7137,7 +7167,7 @@ good-listener@^1.2.2:
dependencies:
delegate "^3.1.2"
graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.2, graceful-fs@^4.2.4:
graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.2:
version "4.2.4"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
@ -8588,17 +8618,6 @@ jest-snapshot@^24.9.0:
pretty-format "^24.9.0"
semver "^6.2.0"
jest-util@26.x:
version "26.1.0"
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.1.0.tgz#80e85d4ba820decacf41a691c2042d5276e5d8d8"
integrity sha512-rNMOwFQevljfNGvbzNQAxdmXQ+NawW/J72dmddsK0E8vgxXCMtwQ/EH0BiWEIxh0hhMcTsxwAxINt7Lh46Uzbg==
dependencies:
"@jest/types" "^26.1.0"
chalk "^4.0.0"
graceful-fs "^4.2.4"
is-ci "^2.0.0"
micromatch "^4.0.2"
jest-util@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162"
@ -9733,7 +9752,7 @@ mkdirp-promise@^5.0.1:
dependencies:
mkdirp "*"
mkdirp@*, mkdirp@1.x:
mkdirp@*:
version "1.0.4"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
@ -12060,7 +12079,7 @@ semver@7.0.0:
resolved "https://registry.npm.taobao.org/semver/download/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
integrity sha1-XzyjV2HkfgWyBsba/yz4FPAxa44=
semver@7.3.2, semver@7.x, semver@^7.2.1, semver@^7.3.2:
semver@7.3.2, semver@^7.2.1, semver@^7.3.2:
version "7.3.2"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==
@ -13146,22 +13165,6 @@ ts-jest@^24.0.0:
semver "^5.5"
yargs-parser "10.x"
ts-jest@^26.1.3:
version "26.1.3"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.1.3.tgz#aac928a05fdf13e3e6dfbc8caec3847442667894"
integrity sha512-beUTSvuqR9SmKQEylewqJdnXWMVGJRFqSz2M8wKJe7GBMmLZ5zw6XXKSJckbHNMxn+zdB3guN2eOucSw2gBMnw==
dependencies:
bs-logger "0.x"
buffer-from "1.x"
fast-json-stable-stringify "2.x"
jest-util "26.x"
json5 "2.x"
lodash.memoize "4.x"
make-error "1.x"
mkdirp "1.x"
semver "7.x"
yargs-parser "18.x"
ts-loader@^8.0.1:
version "8.0.1"
resolved "https://registry.npm.taobao.org/ts-loader/download/ts-loader-8.0.1.tgz?cache=0&sync_timestamp=1594790026943&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fts-loader%2Fdownload%2Fts-loader-8.0.1.tgz#9670dcbce2a8c8506d01a37fee042350d02c8c21"
@ -13183,6 +13186,11 @@ tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==
tslib@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.0.tgz#18d13fc2dce04051e20f074cc8387fd8089ce4f3"
integrity sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==
tsscmp@1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/tsscmp/-/tsscmp-1.0.6.tgz#85b99583ac3589ec4bfef825b5000aa911d605eb"
@ -14023,14 +14031,6 @@ yargs-parser@10.x, yargs-parser@^10.0.0:
dependencies:
camelcase "^4.1.0"
yargs-parser@18.x, yargs-parser@^18.1.3:
version "18.1.3"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
dependencies:
camelcase "^5.0.0"
decamelize "^1.2.0"
yargs-parser@^13.1.2:
version "13.1.2"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38"
@ -14047,6 +14047,14 @@ yargs-parser@^15.0.1:
camelcase "^5.0.0"
decamelize "^1.2.0"
yargs-parser@^18.1.3:
version "18.1.3"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
dependencies:
camelcase "^5.0.0"
decamelize "^1.2.0"
yargs@^13.3.0:
version "13.3.2"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd"