Skip to content

Commit

Permalink
Merge pull request #37 from adambullmer/upgrade-babel
Browse files Browse the repository at this point in the history
Fixed unit testing errors from upgrading babel
  • Loading branch information
adambullmer authored Jul 12, 2017
2 parents 94b7fc1 + cc0988a commit c9d261e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions lib/angular-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
};
Expand Down Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit c9d261e

Please sign in to comment.