From cc0988a4504e7ba75145223369ff5f6e3ab0d2cb Mon Sep 17 00:00:00 2001 From: Adam Bullmer Date: Tue, 11 Jul 2017 22:38:35 -0500 Subject: [PATCH] Fixed unit testing errors from upgrading babel --- lib/angular-app.js | 19 +++++++++++++++++-- package.json | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/angular-app.js b/lib/angular-app.js index 2513d9a..0a64383 100644 --- a/lib/angular-app.js +++ b/lib/angular-app.js @@ -355,11 +355,14 @@ describe("ESLint | ${escape(relativePath)}", function () { }; AngularApp.prototype.runTests = function (appScriptsTree, addonsScriptsTree, vendorScriptsTree, lintingResults) { - const tests = this.babel(this.appTestsTree(), { sourceMap: false }), + const tests = this.babel(this.appTestsTree(), { + plugins: [], + sourceMap: false, + }), karmaConfig = { singleRun: !this.isServing, autoWatch: this.isServing, - configFile: process.cwd() + '/karma.conf.js', + configFile: `${process.cwd()}/karma.conf.js`, files: [ 'scripts/vendor.js', 'tests/angular-mocks.js', 'tests/helpers/**/*.js', '**/*.js' ], annotation: 'Unit Test: Karma' }; @@ -529,11 +532,23 @@ AngularApp.prototype.importStyle = function (filePath) { this.vendorStyles.push(filePath); }; +/** + * Uniformly creates a babel tree. + * Extends the root .babelrc by adding the `transform-es2015-modules-amd` plugin. + * Creates AMD modules, but can be overridden to only transpile using the settings. + * + * @param {Broccoli.tree} tree a broccoli tree + * @param {object} options babel settings + * + * @return {Broccoli.tree} the resulting tree + */ AngularApp.prototype.babel = function (tree, options) { return new Babel(tree, Object.assign({ moduleIds: true, sourceRoot: 'app', resolveModuleSource: amdNameResolver, + extends: `${process.cwd()}/.babelrc`, + plugins: [ "transform-es2015-modules-amd" ], sourceMap: this.isProduction ? false : 'inline', }, options)); } diff --git a/package.json b/package.json index f4e06e9..bb05781 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-bro-app", - "version": "0.11.2", + "version": "0.11.3", "description": "Angular broccoli plugin and compilation routine", "main": "lib/angular-app.js", "scripts": {