Permalink
Browse files

fix(jest): resolve babel-jest error

Jest does not have proper support for setups that use both a .babelrc and .babelrc.js file as it throws babel errors when you have both. The fix must be made in babel-jest, until then we can use a fork so that atleast jest will function
  • Loading branch information...
JeroenVinke committed Aug 24, 2017
1 parent b6133e5 commit 3cfd95672bfee4fbb356fe2ccded9292294348f8
Showing with 30 additions and 27 deletions.
  1. +1 −1 lib/dependencies.json
  2. +24 −22 lib/resources/content/babelrc.webpack.js
  3. +5 −4 lib/resources/tasks/jest.js
View
@@ -18,7 +18,7 @@
"awesome-typescript-loader": "^3.2.1",
"babel-core": "^6.25.0",
"babel-eslint": "^6.0.4",
"babel-jest": "^20.0.3",
"babel-jest": "github:JeroenVinke/babel-jest",
"babel-loader": "^7.0.0",
"babel-plugin-istanbul": "4.1.4",
"babel-plugin-syntax-flow": "^6.8.0",
@@ -1,25 +1,27 @@
// this file will be used by default by babel@7 once it is released
module.exports = {
"plugins": [
"transform-decorators-legacy",
"transform-class-properties"
],
"presets": [
[
"env", {
"targets": process.env.BABEL_TARGET === 'node' ? {
"node": process.env.IN_PROTRACTOR ? '6' : 'current'
} : {
"browsers": [
"last 2 versions",
"not ie <= 11"
],
"uglify": process.env.NODE_ENV === 'production',
},
"loose": true,
"modules": process.env.BABEL_TARGET === 'node' ? 'commonjs' : false,
"useBuiltIns": true
}
module.exports = () => {
return {
"plugins": [
"transform-decorators-legacy",
"transform-class-properties"
],
"presets": [
[
"env", {
"targets": process.env.BABEL_TARGET === 'node' ? {
"node": process.env.IN_PROTRACTOR ? '6' : 'current'
} : {
"browsers": [
"last 2 versions",
"not ie <= 11"
],
"uglify": process.env.NODE_ENV === 'production',
},
"loose": true,
"modules": process.env.BABEL_TARGET === 'node' ? 'commonjs' : false,
"useBuiltIns": true
}
]
]
]
}
}
@@ -1,22 +1,23 @@
import jest from 'jest-cli';
import gutil from 'gulp-util';
import through2 from 'through2';
import path from 'path';
import packageJson from '../../package.json';
import {CLIOptions} from 'aurelia-cli';
export default (cb) => {
let options = packageJson.jest;
if (CLIOptions.hasFlag('watch')) {
Object.assign(options, { watch: true});
}
process.env.BABEL_TARGET = 'node';
jest.runCLI(options, [path.resolve(__dirname, '../../')], (result) => {
if(result.numFailedTests || result.numFailedTestSuites) {
if (result.numFailedTests || result.numFailedTestSuites) {
cb(new gutil.PluginError('gulp-jest', { message: 'Tests Failed' }));
} else {
cb();
}
});
};
};

0 comments on commit 3cfd956

Please sign in to comment.