diff --git a/lib/dependencies.json b/lib/dependencies.json index fc07310eb..1ad9d4e66 100644 --- a/lib/dependencies.json +++ b/lib/dependencies.json @@ -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", diff --git a/lib/resources/content/babelrc.webpack.js b/lib/resources/content/babelrc.webpack.js index dfd667fd2..4d2bde999 100644 --- a/lib/resources/content/babelrc.webpack.js +++ b/lib/resources/content/babelrc.webpack.js @@ -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 + } + ] ] - ] + } } \ No newline at end of file diff --git a/lib/resources/tasks/jest.js b/lib/resources/tasks/jest.js index 76b4c6bfd..b17e67996 100644 --- a/lib/resources/tasks/jest.js +++ b/lib/resources/tasks/jest.js @@ -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(); } }); -}; \ No newline at end of file +};