Skip to content

Commit

Permalink
Use esbuild instead of babel for tests (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebeby committed Mar 22, 2021
1 parent 732fbff commit 737d782
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
13 changes: 0 additions & 13 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
module.exports = (api) => {
const isTest = api.env('test');

const isRollup = api.caller((c) => c && c.name === '@rollup/plugin-babel');

if (isTest)
return {
plugins: [
'@babel/transform-modules-commonjs',
// TODO: remove when node 12 is dropped
'@babel/plugin-proposal-optional-chaining',
],
// not using preset-env here because it slows down the tests a lot
presets: ['@babel/preset-typescript'],
};

return {
presets: [
[
Expand Down
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ module.exports = {
'test-mule': '<rootDir>/dist/cjs/index.cjs',
},
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.tsx?$': ['esbuild-jest', { sourcemap: true }],
},
};
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"babel-plugin-un-cjs": "^2.3.0",
"env-paths": "^2.2.0",
"errorstacks": "^2.3.0",
"esbuild-jest": "^0.5.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jscodeshift": "^0.11.0",
Expand Down

0 comments on commit 737d782

Please sign in to comment.