diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 733710bb005bca95e71519388978cf4c44886e4d..8d6383dfdb9426fd0ef1305533895f5fd8f7ad53 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -252,7 +252,7 @@ karma: name: coverage-javascript expire_in: 31d paths: - - coverage-javascript/default/ + - coverage-javascript/ lint-doc: stage: test @@ -395,7 +395,7 @@ pages: - mv public/ .public/ - mkdir public/ - mv coverage/ public/coverage-ruby/ || true - - mv coverage-javascript/default/ public/coverage-javascript/ || true + - mv coverage-javascript/ public/coverage-javascript/ || true - mv eslint-report.html public/ || true artifacts: paths: diff --git a/changelogs/unreleased/cover-my-karma.yml b/changelogs/unreleased/cover-my-karma.yml new file mode 100644 index 0000000000000000000000000000000000000000..4a823dc5ca4d33b218119d7b623a2f338144b6ad --- /dev/null +++ b/changelogs/unreleased/cover-my-karma.yml @@ -0,0 +1,4 @@ +--- +title: Reintroduce coverage report for JavaScript +merge_request: 9133 +author: winniehell diff --git a/config/karma.config.js b/config/karma.config.js index 44229e2ee886ed26fbcfc08241ba6c180d00e534..a1fbeab1f469185c09e09044d623bd46576dd26c 100644 --- a/config/karma.config.js +++ b/config/karma.config.js @@ -15,6 +15,13 @@ module.exports = function(config) { preprocessors: { 'spec/javascripts/**/*.js?(.es6)': ['webpack', 'sourcemap'], }, + reporters: ['progress', 'coverage-istanbul'], + coverageIstanbulReporter: { + reports: ['html', 'text-summary'], + dir: 'coverage-javascript/', + subdir: '.', + fixWebpackSourcePaths: true + }, webpack: webpackConfig, webpackMiddleware: { stats: 'errors-only' }, }); diff --git a/config/webpack.config.js b/config/webpack.config.js index 00f448c1fbb7c9d3c0662580bc9983027c6e0b21..e800cc3fd84e88d614208ed59ea33411e66426c8 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -54,6 +54,7 @@ var config = { exclude: /(node_modules|vendor\/assets)/, loader: 'babel-loader', options: { + plugins: ['istanbul'], presets: [ ["es2015", {"modules": false}], 'stage-2' diff --git a/package.json b/package.json index 24e11a4607ff572eea822ef53deb2fd46f136109..dbdbeabfb67ac97a4944c0c071193e0d90174c5b 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "webpack-dev-server": "^2.3.0" }, "devDependencies": { + "babel-plugin-istanbul": "^4.0.0", "eslint": "^3.10.1", "eslint-config-airbnb-base": "^10.0.1", "eslint-plugin-filenames": "^1.1.0", @@ -45,9 +46,18 @@ "jasmine-core": "^2.5.2", "jasmine-jquery": "^2.1.1", "karma": "^1.4.1", + "karma-coverage-istanbul-reporter": "^0.2.0", "karma-jasmine": "^1.1.0", "karma-phantomjs-launcher": "^1.0.2", "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^2.0.2" + }, + "nyc": { + "exclude": [ + "spec/javascripts/test_bundle.js", + "spec/javascripts/**/*_spec.js", + "spec/javascripts/**/*_spec.js.es6", + "app/assets/javascripts/droplab/**/*" + ] } }