Commit dd43a0db authored by Robert Knight's avatar Robert Knight

Update dependencies for compatibility with Babel 7

Upgrade the dependencies used for adding dependency injection
annotations to Angular components and services, and the libs used for
code coverage reporting.

- Replace browserify-ngannotate with babel-plugin-angularjs-annotate.
  The repo's README states that the former is unmaintained and the
  latter is the successor.

- Replace browserify-istanbul + isparta + karma-coverage for code
  coverage reporting with babel-plugin-istanbul +
  karma-coverage-istanbul-reporter.

  babel-plugin-istanbul is the recommended method for instrumenting code
  using current versions of Istanbul. The karma-coverage reporter uses
  an old version of Istanbul. karma-coverage-istanbul-reporter is
  a reporter that uses the current version and is intended to be used
  alongside the Babel plugin.

- Upgrade karma and karma-browserify
parent cb50903e
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
} }
}] }]
], ],
"plugins": ["angularjs-annotate"],
"ignore": ["**/vendor/*"] "ignore": ["**/vendor/*"]
} }
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
"autofill-event": "0.0.1", "autofill-event": "0.0.1",
"autoprefixer": "^9.4.7", "autoprefixer": "^9.4.7",
"aws-sdk": "^2.345.0", "aws-sdk": "^2.345.0",
"babel-plugin-angularjs-annotate": "^0.9.0",
"babel-plugin-istanbul": "^5.1.0",
"babel-preset-env": "^1.7.0", "babel-preset-env": "^1.7.0",
"babelify": "^10.0.0", "babelify": "^10.0.0",
"browserify": "^16.2.3", "browserify": "^16.2.3",
"browserify-istanbul": "^2.0.0",
"browserify-ngannotate": "^2.0.0",
"browserify-shim": "^3.8.12", "browserify-shim": "^3.8.12",
"browserify-versionify": "^1.0.6", "browserify-versionify": "^1.0.6",
"chai": "^4.1.2", "chai": "^4.1.2",
...@@ -64,14 +64,12 @@ ...@@ -64,14 +64,12 @@
"gulp-sourcemaps": "^2.6.4", "gulp-sourcemaps": "^2.6.4",
"gulp-util": "^3.0.7", "gulp-util": "^3.0.7",
"hammerjs": "^2.0.4", "hammerjs": "^2.0.4",
"isparta": "^4.0.0",
"istanbul": "^0.4.5",
"jquery": "^3.2.1", "jquery": "^3.2.1",
"js-polyfills": "^0.1.16", "js-polyfills": "^0.1.16",
"karma": "^4.0.0", "karma": "^4.0.0",
"karma-browserify": "^6.0.0", "karma-browserify": "^6.0.0",
"karma-chai": "^0.1.0", "karma-chai": "^0.1.0",
"karma-coverage": "^1.1.1", "karma-coverage-istanbul-reporter": "^2.0.4",
"karma-mocha": "^1.1.1", "karma-mocha": "^1.1.1",
"karma-mocha-reporter": "^2.0.4", "karma-mocha-reporter": "^2.0.4",
"karma-phantomjs-launcher": "^1.0.1", "karma-phantomjs-launcher": "^1.0.1",
...@@ -113,7 +111,6 @@ ...@@ -113,7 +111,6 @@
}, },
"browserify": { "browserify": {
"transform": [ "transform": [
"browserify-ngannotate",
"browserify-shim", "browserify-shim",
"browserify-versionify", "browserify-versionify",
[ [
......
'use strict'; 'use strict';
const istanbul = require('browserify-istanbul'); /* global __dirname */
const path = require('path');
module.exports = function(config) { module.exports = function(config) {
config.set({ config.set({
...@@ -63,23 +65,12 @@ module.exports = function(config) { ...@@ -63,23 +65,12 @@ module.exports = function(config) {
transform: [ transform: [
'coffeeify', 'coffeeify',
istanbul({ ['babelify', {
ignore: [ // The transpiled CoffeeScript is fed through Babelify to add
// Third party code // code coverage instrumentation for Istanbul.
'**/node_modules/**', '**/vendor/*', extensions: ['.js', '.coffee'],
// Non JS modules plugins: ['babel-plugin-istanbul'],
'**/*.html', '**/*.svg', }],
],
// There is an outstanding bug with karma-coverage and istanbul
// in regards to doing source mapping and transpiling CoffeeScript.
// The least bad work around is to replace the instrumenter with
// isparta and it will handle doing the re mapping for us.
// This issue follows the issue and attempts to fix it:
// https://github.com/karma-runner/karma-coverage/issues/157
instrumenter: require('isparta'),
}),
'babelify',
], ],
}, },
...@@ -91,17 +82,17 @@ module.exports = function(config) { ...@@ -91,17 +82,17 @@ module.exports = function(config) {
output: 'minimal', output: 'minimal',
}, },
coverageReporter: { coverageIstanbulReporter: {
dir: '../coverage/', dir: path.join(__dirname, '../coverage'),
reporters: [ reports: ['json', 'html'],
{type:'html'}, 'report-config': {
{type:'json', subdir: './'}, json: { subdir: './' },
], },
}, },
// Use https://www.npmjs.com/package/karma-mocha-reporter // Use https://www.npmjs.com/package/karma-mocha-reporter
// for more helpful rendering of test failures // for more helpful rendering of test failures
reporters: ['mocha', 'coverage'], reporters: ['mocha', 'coverage-istanbul'],
// web server port // web server port
port: 9876, port: 9876,
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment