Skip to content

Commit

Permalink
Add Istanbul to report coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Oct 13, 2017
1 parent 4f6a479 commit c4d7249
Show file tree
Hide file tree
Showing 4 changed files with 518 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ $ cat .gitignore
/node_modules
/dist
/site
/coverage

*.log
*.tgz
33 changes: 30 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path');

module.exports = function (config) {

const configuration = {
Expand All @@ -14,7 +16,9 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-webpack'),
require('karma-sourcemap-loader'),
require('karma-spec-reporter')
require('karma-spec-reporter'),
require('karma-coverage-istanbul-reporter'),
require("istanbul-instrumenter-loader")
],

// list of files / patterns to load in the browser
Expand All @@ -41,8 +45,25 @@ module.exports = function (config) {
rules: [
{
test: /\.ts/,
loaders: ['ts-loader', 'source-map-loader'],
use: [
{ loader: 'ts-loader' },
{ loader: 'source-map-loader' }
],
exclude: /node_modules/
},
{
enforce: 'post',
test: /\.ts/,
use: [
{
loader: 'istanbul-instrumenter-loader',
options: { esModules: true }
}
],
exclude: [
/\.spec.ts/,
/node_modules/
]
}
],
exprContextCritical: false
Expand All @@ -59,7 +80,13 @@ module.exports = function (config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec'],
reporters: ['spec', 'coverage-istanbul'],

coverageIstanbulReporter: {
reports: ['html', 'lcovonly'],
dir: path.join(__dirname, 'coverage'),
fixWebpackSourcePaths: true
},


// web server port
Expand Down
Loading

0 comments on commit c4d7249

Please sign in to comment.