Skip to content

Commit

Permalink
Fix babelrc for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pshrmn committed Jun 20, 2017
1 parent 5dd84e8 commit d836b6b
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 10 deletions.
10 changes: 1 addition & 9 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
{
"presets":[
["env", {
modules: false,
targets: {
browsers: ['> 1%']
}
}]
],
"plugins": ["transform-export-extensions", "external-helpers"],
"presets": ["./babel/config"]
}
21 changes: 21 additions & 0 deletions babel/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const envPreset = require('babel-preset-env').default;

const testing = process.env.BABEL_ENV === 'test';

const plugins = ['transform-export-extensions'];

if (!testing) {
plugins.push('external-helpers');
}

module.exports = {
presets:[
['env', {
modules: testing ? 'commonjs' : false,
targets: {
browsers: ['> 1%']
}
}]
],
plugins: plugins
};
48 changes: 48 additions & 0 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"prebuild": "rimraf dist",
"build": "node ./scripts/build",
"prepublishOnly": "in-publish && npm run build",
"test": "jest"
"test": "cross-env BABEL_ENV=test jest"
},
"repository": {
"type": "git",
Expand All @@ -40,6 +40,7 @@
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-preset-env": "^1.5.2",
"cross-env": "^5.0.1",
"gzip-size": "^3.0.0",
"in-publish": "^2.0.0",
"jest": "^20.0.4",
Expand Down

0 comments on commit d836b6b

Please sign in to comment.