Skip to content

Commit 737d782

Browse files
authored
Use esbuild instead of babel for tests (#49)
1 parent 732fbff commit 737d782

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

babel.config.cjs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
module.exports = (api) => {
2-
const isTest = api.env('test');
3-
42
const isRollup = api.caller((c) => c && c.name === '@rollup/plugin-babel');
53

6-
if (isTest)
7-
return {
8-
plugins: [
9-
'@babel/transform-modules-commonjs',
10-
// TODO: remove when node 12 is dropped
11-
'@babel/plugin-proposal-optional-chaining',
12-
],
13-
// not using preset-env here because it slows down the tests a lot
14-
presets: ['@babel/preset-typescript'],
15-
};
16-
174
return {
185
presets: [
196
[

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ module.exports = {
44
'test-mule': '<rootDir>/dist/cjs/index.cjs',
55
},
66
testRunner: 'jest-circus/runner',
7+
transform: {
8+
'^.+\\.tsx?$': ['esbuild-jest', { sourcemap: true }],
9+
},
710
};

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"babel-plugin-un-cjs": "^2.3.0",
2626
"env-paths": "^2.2.0",
2727
"errorstacks": "^2.3.0",
28+
"esbuild-jest": "^0.5.0",
2829
"jest": "^26.6.3",
2930
"jest-circus": "^26.6.3",
3031
"jscodeshift": "^0.11.0",

0 commit comments

Comments
 (0)