Skip to content

Commit

Permalink
Babelify juggler for Karma tests
Browse files Browse the repository at this point in the history
Fix configuration of Karma:

 - Disable ES6 modules. The ES6 module transpiler is adding
  "use strict" to all source files, this breaks e.g. chai or juggler
 - Relax "ignore" setting to exclude only strong-task-emitter,
   thus bring back Babel transpilation for chai and juggler.
  • Loading branch information
bajtos authored and Kevin Delisle committed Feb 9, 2018
1 parent b2cf877 commit 1575bec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -67,11 +67,13 @@
"loopback-datasource-juggler": "^2.56.0"
},
"devDependencies": {
"babel-preset-es2015": "^6.24.1",
"babelify": "^7.3.0",
"bluebird": "^3.4.1",
"browserify": "^13.1.0",
"chai": "^3.5.0",
"es5-shim": "^4.1.0",
"coveralls": "^2.11.15",
"es5-shim": "^4.1.0",
"express-session": "^1.14.0",
"grunt": "^1.0.1",
"grunt-browserify": "^5.0.0",
Expand Down
20 changes: 10 additions & 10 deletions test/karma.conf.js
Expand Up @@ -106,23 +106,23 @@ module.exports = function(config) {
],
transform: [
['babelify', {
presets: 'es2015',
presets: [
['es2015', {
// Disable transform-es2015-modules-commonjs which adds
// "use strict" to all files, even those that don't work
// in strict mode
// (e.g. chai, loopback-datasource-juggler, etc.)
modules: false,
}],
],
// By default, browserify does not transform node_modules
// As a result, our dependencies like strong-remoting and juggler
// are kept in original ES6 form that does not work in PhantomJS
global: true,
// Prevent SyntaxError in strong-task-emitter:
// strong-task-emitter/lib/task.js (83:4):
// arguments is a reserved word in strict mode
// Prevent TypeError in chai:
// 'caller', 'callee', and 'arguments' properties may not be
// accessed on strict mode functions or the arguments objects
// for calls to them
// Prevent TypeError in loopback-datasource-juggler:
// 'caller', 'callee', and 'arguments' properties may not be
// accessed on strict mode functions or the arguments objects
// for calls to them
ignore: /node_modules\/(strong-task-emitter|chai|loopback-datasource-juggler)\//,
ignore: /node_modules\/(strong-task-emitter)\//,
}],
],
// transform: ['coffeeify'],
Expand Down

0 comments on commit 1575bec

Please sign in to comment.