Skip to content

Commit

Permalink
Add basic coverage possibilty.
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrozbinden committed Apr 16, 2017
1 parent 179baf5 commit cf73390
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"test": "karma start ./test-config/karma.conf.js"
"test": "karma start ./test-config/karma.conf.js",
"test-coverage": "karma start ./test-config/karma.conf.js --coverage"
},
"config": {
"ionic_source_map": "source-map"
Expand Down Expand Up @@ -47,17 +48,23 @@
"jasmine": "^2.5.3",
"karma": "^1.5.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-typescript": "^3.0.0",
"karma-verbose-reporter": "0.0.6",
"karma-webpack": "^2.0.3",
"null-loader": "^0.1.1",
"remap-istanbul": "^0.9.5",
"systemjs": "^0.20.12",
"ts-loader": "^2.0.3",
"tslint": "^5.0.0",
"tslint-ionic-rules": "0.0.8",
"typescript": "2.1.6"
"typescript": "^2.1.6",
"istanbul-instrumenter-loader": "^2.0.0",
"karma-coverage-istanbul-reporter": "^1.0.0"
},
"version": "0.0.1",
"description": "Cross-Platform Ionic App for IMS"
}
}
9 changes: 8 additions & 1 deletion test-config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ module.exports = function (config) {
terminal: true
},

reporters: ['kjhtml', 'dots', 'verbose'],
coverageIstanbulReporter: {
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},



reporters: config.coverage ? ['kjhtml', 'dots', 'coverage-istanbul', 'verbose'] : ['kjhtml', 'dots', 'verbose'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
Expand Down
11 changes: 10 additions & 1 deletion test-config/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,18 @@ module.exports = {
loaders: [
{
loader: 'ts-loader'
} , 'angular2-template-loader'
}, 'angular2-template-loader'
]
},
{
test: /.+\.ts$/,
exclude: /(index.ts|mocks.ts|\.spec\.ts$)/,
loader: 'istanbul-instrumenter-loader',
enforce: 'post',
query: {
esModules: true
}
},
{
test: /\.html$/,
loader: 'html-loader'
Expand Down

0 comments on commit cf73390

Please sign in to comment.