0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 21:49:51 +01:00

chore: switch from esbuild-jest to sucrase for frontend tests (#13636)

This commit is contained in:
Marius Andra 2023-01-11 11:35:15 +01:00 committed by GitHub
parent f51908b59c
commit 5b44f9c96a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 57 deletions

View File

@ -189,7 +189,7 @@ const config: Config = {
// A map from regular expressions to paths to transformers
transform: {
'\\.[jt]sx?$': 'esbuild-jest',
'\\.[jt]sx?$': '@sucrase/jest-plugin',
},
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation

View File

@ -161,6 +161,7 @@
"@storybook/core-events": "^6.5.14",
"@storybook/react": "^6.5.14",
"@storybook/theming": "^6.5.14",
"@sucrase/jest-plugin": "^3.0.0",
"@testing-library/dom": ">=7.21.4",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.2",
@ -201,7 +202,6 @@
"cypress": "^10.11.0",
"cypress-axe": "^1.0.0",
"cypress-terminal-report": "^4.1.2",
"esbuild-jest": "^0.5.0",
"eslint": "^7.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-cypress": "^2.12.1",
@ -234,6 +234,7 @@
"storybook-addon-pseudo-states": "^1.15.1",
"storybook-addon-turbo-build": "^1.1.0",
"style-loader": "^2.0.0",
"sucrase": "^3.29.0",
"timekeeper": "^2.2.0",
"ts-json-schema-generator": "^1.1.2",
"ts-node": "^10.9.1",

View File

@ -34,6 +34,7 @@ specifiers:
'@storybook/core-events': ^6.5.14
'@storybook/react': ^6.5.14
'@storybook/theming': ^6.5.14
'@sucrase/jest-plugin': ^3.0.0
'@testing-library/dom': '>=7.21.4'
'@testing-library/jest-dom': ^5.16.2
'@testing-library/react': ^12.1.2
@ -88,7 +89,6 @@ specifiers:
d3-sankey: ^0.12.3
dayjs: ^1.10.7
esbuild: ^0.14.54
esbuild-jest: ^0.5.0
esbuild-plugin-less: ^1.1.7
esbuild-sass-plugin: ^1.8.2
eslint: ^7.8.0
@ -173,6 +173,7 @@ specifiers:
storybook-addon-pseudo-states: ^1.15.1
storybook-addon-turbo-build: ^1.1.0
style-loader: ^2.0.0
sucrase: ^3.29.0
timekeeper: ^2.2.0
ts-json-schema-generator: ^1.1.2
ts-node: ^10.9.1
@ -300,6 +301,7 @@ devDependencies:
'@storybook/core-events': 6.5.14
'@storybook/react': 6.5.14_ynw662n6z6lgugf2bmr63fewey
'@storybook/theming': 6.5.14_wcqkhtmu7mswc6yz4uyexck3ty
'@sucrase/jest-plugin': 3.0.0_jest@29.3.1+sucrase@3.29.0
'@testing-library/jest-dom': 5.16.5
'@testing-library/react': 12.1.5_wcqkhtmu7mswc6yz4uyexck3ty
'@testing-library/user-event': 13.5.0_aaq3sbffpfe3jnxzm2zngsddei
@ -333,7 +335,6 @@ devDependencies:
cypress: 10.11.0
cypress-axe: 1.0.0_zbyslzparjzi42gvvujtlkgxya
cypress-terminal-report: 4.1.2_cypress@10.11.0
esbuild-jest: 0.5.0_esbuild@0.14.54
eslint: 7.32.0
eslint-config-prettier: 8.5.0_eslint@7.32.0
eslint-plugin-cypress: 2.12.1_eslint@7.32.0
@ -366,6 +367,7 @@ devDependencies:
storybook-addon-pseudo-states: 1.15.1_37oqtmovxyddi5n4m2fn2s3yny
storybook-addon-turbo-build: 1.1.0_webpack@4.46.0
style-loader: 2.0.0_webpack@4.46.0
sucrase: 3.29.0
timekeeper: 2.2.0
ts-json-schema-generator: 1.1.2
ts-node: 10.9.1_cbe7ovvae6zqfnmtgctpgpys54
@ -1978,6 +1980,7 @@ packages:
cpu: [loong64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-loong64/0.15.13:
@ -3982,6 +3985,16 @@ packages:
resolve-from: 5.0.0
dev: true
/@sucrase/jest-plugin/3.0.0_jest@29.3.1+sucrase@3.29.0:
resolution: {integrity: sha512-VRY6YKYImVWiRg1H3Yu24hwB1UPJDSDR62R/n+lOHR3+yDrfHEIAoddJivblMYN6U3vD+ndfTSrecZ9Jl+iGNw==}
peerDependencies:
jest: '>=27'
sucrase: '>=3.25.0'
dependencies:
jest: 29.3.1_odkjkoia5xunhxkdrka32ib6vi
sucrase: 3.29.0
dev: true
/@testing-library/dom/8.19.0:
resolution: {integrity: sha512-6YWYPPpxG3e/xOo6HIWwB/58HukkwIVTOaZ0VwdMVjhRUX/01E4FtQbck9GazOOj7MXHc5RBzMrU86iBJHbI+A==}
engines: {node: '>=12'}
@ -5283,6 +5296,10 @@ packages:
scroll-into-view-if-needed: 2.2.26
dev: false
/any-promise/1.3.0:
resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
dev: true
/anymatch/2.0.0:
resolution: {integrity: sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==}
dependencies:
@ -5600,25 +5617,6 @@ packages:
- supports-color
dev: true
/babel-jest/26.6.3_@babel+core@7.20.2:
resolution: {integrity: sha512-pl4Q+GAVOHwvjrck6jKjvmGhnO3jHX/xuB9d27f+EJZ/6k+6nMuPjorrYp7s++bKKdANwzElBWnLWaObvTnaZA==}
engines: {node: '>= 10.14.2'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.20.2
'@jest/transform': 26.6.2
'@jest/types': 26.6.2
'@types/babel__core': 7.1.19
babel-plugin-istanbul: 6.1.1
babel-preset-jest: 26.6.2_@babel+core@7.20.2
chalk: 4.1.2
graceful-fs: 4.2.10
slash: 3.0.0
transitivePeerDependencies:
- supports-color
dev: true
/babel-jest/29.3.1_@babel+core@7.20.2:
resolution: {integrity: sha512-aard+xnMoxgjwV70t0L6wkW/3HQQtV+O0PEimxKgzNqCJnbYmroPojdP2tqKSOAt8QAKV/uSZU8851M7B5+fcA==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@ -5691,16 +5689,6 @@ packages:
- supports-color
dev: true
/babel-plugin-jest-hoist/26.6.2:
resolution: {integrity: sha512-PO9t0697lNTmcEHH69mdtYiOIkkOlj9fySqfO3K1eCcdISevLAE0xY59VLLUj0SoiPiTX/JU2CYFpILydUa5Lw==}
engines: {node: '>= 10.14.2'}
dependencies:
'@babel/template': 7.18.10
'@babel/types': 7.20.2
'@types/babel__core': 7.1.19
'@types/babel__traverse': 7.18.2
dev: true
/babel-plugin-jest-hoist/29.2.0:
resolution: {integrity: sha512-TnspP2WNiR3GLfCsUNHqeXw0RoQ2f9U5hQ5L3XFpwuO8htQmSrhh8qsB6vi5Yi8+kuynN1yjDjQsPfkebmB6ZA==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@ -5795,17 +5783,6 @@ packages:
'@babel/plugin-syntax-top-level-await': 7.14.5_@babel+core@7.20.2
dev: true
/babel-preset-jest/26.6.2_@babel+core@7.20.2:
resolution: {integrity: sha512-YvdtlVm9t3k777c5NPQIv6cxFFFapys25HiUmuSgHwIZhfifweR5c5Sf5nwE3MAbfu327CYSvps8Yx6ANLyleQ==}
engines: {node: '>= 10.14.2'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.20.2
babel-plugin-jest-hoist: 26.6.2
babel-preset-current-node-syntax: 1.0.1_@babel+core@7.20.2
dev: true
/babel-preset-jest/29.2.0_@babel+core@7.20.2:
resolution: {integrity: sha512-z9JmMJppMxNv8N7fNRHvhMg9cvIkMxQBXgFkane3yKVEvEOP+kB50lk8DFRvF9PGqbyXxlmebKWhuDORO8RgdA==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@ -8121,6 +8098,7 @@ packages:
cpu: [x64]
os: [android]
requiresBuild: true
dev: false
optional: true
/esbuild-android-64/0.15.13:
@ -8138,6 +8116,7 @@ packages:
cpu: [arm64]
os: [android]
requiresBuild: true
dev: false
optional: true
/esbuild-android-arm64/0.15.13:
@ -8155,6 +8134,7 @@ packages:
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/esbuild-darwin-64/0.15.13:
@ -8172,6 +8152,7 @@ packages:
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/esbuild-darwin-arm64/0.15.13:
@ -8189,6 +8170,7 @@ packages:
cpu: [x64]
os: [freebsd]
requiresBuild: true
dev: false
optional: true
/esbuild-freebsd-64/0.15.13:
@ -8206,6 +8188,7 @@ packages:
cpu: [arm64]
os: [freebsd]
requiresBuild: true
dev: false
optional: true
/esbuild-freebsd-arm64/0.15.13:
@ -8217,25 +8200,13 @@ packages:
dev: true
optional: true
/esbuild-jest/0.5.0_esbuild@0.14.54:
resolution: {integrity: sha512-AMZZCdEpXfNVOIDvURlqYyHwC8qC1/BFjgsrOiSL1eyiIArVtHL8YAC83Shhn16cYYoAWEW17yZn0W/RJKJKHQ==}
peerDependencies:
esbuild: '>=0.8.50'
dependencies:
'@babel/core': 7.20.2
'@babel/plugin-transform-modules-commonjs': 7.19.6_@babel+core@7.20.2
babel-jest: 26.6.3_@babel+core@7.20.2
esbuild: 0.14.54
transitivePeerDependencies:
- supports-color
dev: true
/esbuild-linux-32/0.14.54:
resolution: {integrity: sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==}
engines: {node: '>=12'}
cpu: [ia32]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-32/0.15.13:
@ -8253,6 +8224,7 @@ packages:
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-64/0.15.13:
@ -8270,6 +8242,7 @@ packages:
cpu: [arm]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-arm/0.15.13:
@ -8287,6 +8260,7 @@ packages:
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-arm64/0.15.13:
@ -8304,6 +8278,7 @@ packages:
cpu: [mips64el]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-mips64le/0.15.13:
@ -8321,6 +8296,7 @@ packages:
cpu: [ppc64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-ppc64le/0.15.13:
@ -8338,6 +8314,7 @@ packages:
cpu: [riscv64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-riscv64/0.15.13:
@ -8355,6 +8332,7 @@ packages:
cpu: [s390x]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-s390x/0.15.13:
@ -8386,6 +8364,7 @@ packages:
cpu: [x64]
os: [netbsd]
requiresBuild: true
dev: false
optional: true
/esbuild-netbsd-64/0.15.13:
@ -8403,6 +8382,7 @@ packages:
cpu: [x64]
os: [openbsd]
requiresBuild: true
dev: false
optional: true
/esbuild-openbsd-64/0.15.13:
@ -8441,6 +8421,7 @@ packages:
cpu: [x64]
os: [sunos]
requiresBuild: true
dev: false
optional: true
/esbuild-sunos-64/0.15.13:
@ -8458,6 +8439,7 @@ packages:
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: false
optional: true
/esbuild-windows-32/0.15.13:
@ -8475,6 +8457,7 @@ packages:
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/esbuild-windows-64/0.15.13:
@ -8492,6 +8475,7 @@ packages:
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/esbuild-windows-arm64/0.15.13:
@ -8530,6 +8514,7 @@ packages:
esbuild-windows-32: 0.14.54
esbuild-windows-64: 0.14.54
esbuild-windows-arm64: 0.14.54
dev: false
/esbuild/0.15.13:
resolution: {integrity: sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==}
@ -9669,6 +9654,17 @@ packages:
resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==}
dev: true
/glob/7.1.6:
resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==}
dependencies:
fs.realpath: 1.0.0
inflight: 1.0.6
inherits: 2.0.4
minimatch: 3.1.2
once: 1.4.0
path-is-absolute: 1.0.1
dev: true
/glob/7.2.3:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
dependencies:
@ -12473,6 +12469,14 @@ packages:
resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==}
dev: true
/mz/2.7.0:
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
dependencies:
any-promise: 1.3.0
object-assign: 4.1.1
thenify-all: 1.6.0
dev: true
/nan/2.17.0:
resolution: {integrity: sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==}
dev: true
@ -16194,6 +16198,19 @@ packages:
resolution: {integrity: sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA==}
dev: false
/sucrase/3.29.0:
resolution: {integrity: sha512-bZPAuGA5SdFHuzqIhTAqt9fvNEo9rESqXIG3oiKdF8K4UmkQxC4KlNL3lVyAErXp+mPvUqZ5l13qx6TrDIGf3A==}
engines: {node: '>=8'}
hasBin: true
dependencies:
commander: 4.1.1
glob: 7.1.6
lines-and-columns: 1.2.4
mz: 2.7.0
pirates: 4.0.5
ts-interface-checker: 0.1.13
dev: true
/supports-color/5.5.0:
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
engines: {node: '>=4'}
@ -16382,6 +16399,19 @@ packages:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
dev: true
/thenify-all/1.6.0:
resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
engines: {node: '>=0.8'}
dependencies:
thenify: 3.3.1
dev: true
/thenify/3.3.1:
resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
dependencies:
any-promise: 1.3.0
dev: true
/throttle-debounce/2.3.0:
resolution: {integrity: sha512-H7oLPV0P7+jgvrk+6mwwwBDmxTaxnu9HMXmloNLXwnNO0ZxZ31Orah2n8lU1eMPvsaowP2CX+USCgyovXfdOFQ==}
engines: {node: '>=8'}
@ -16551,6 +16581,10 @@ packages:
resolution: {integrity: sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ==}
dev: false
/ts-interface-checker/0.1.13:
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
dev: true
/ts-json-schema-generator/1.1.2:
resolution: {integrity: sha512-XMnxvndJFJEYv3NBmW7Po5bGajKdK2qH8Q078eDy60srK9+nEvbT9nLCRKd2IV/RQ7a+oc5FNylvZWveqh7jeQ==}
engines: {node: '>=10.0.0'}