Skip to content

Commit

Permalink
Only set babel node target for test env
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Ashcraft committed Jun 10, 2019
1 parent 017a46e commit 392ee16
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@

'use strict';

// NOTE(ryan): Set node target to current for @babel/preset-env to avoid errors when running jest
// `async` test functions ("ReferenceError: regeneratorRuntime is not defined").
// https://github.com/facebook/jest/issues/3126#issuecomment-483320742

module.exports = {
presets: [
'@babel/preset-react',
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
presets: ['@babel/preset-react', '@babel/preset-env'],
plugins: ['@babel/plugin-proposal-object-rest-spread'],
env: {
test: {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
},
},
};

0 comments on commit 392ee16

Please sign in to comment.