Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Adding new 'coverage' command to run unit test coverage reporting, re… #10

Merged
merged 1 commit into from
Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ A basic Angular 4 seed project utilizing the following technologies:

* `npm start` - start the development webpack server (access via http://localhost:3000/)
* `npm test` - run the project unit tests (*.spec.ts files)
* `npm run coverage` - run the project unit tests one time and print out a coverage report, generated under **/coverage/index.html**
* `npm run lint` - run the project linting (will be run every time `npm test` is run)
* `npm run build` - generate a production build for the project, which will be inserted into dist/
9 changes: 4 additions & 5 deletions config/test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ module.exports = function(config) {
require('karma-sourcemap-loader')
],
client:{
clearContext: false
clearContext: false,
args: [ '--coverage', config.coverage ]
},
webpack: webpackConfig,
coverageIstanbulReporter: {
Expand All @@ -34,14 +35,12 @@ module.exports = function(config) {
exclude: /\*.spec.ts/
}
},
// TODO build flag/param to specify coverage mode
reporters: [ 'progress', /*'kjhtml', */'coverage-istanbul' ],
reporters: config.coverage ? [ 'progress', 'coverage-istanbul' ] : [ 'progress', 'kjhtml' ],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: [ 'Chrome' ],
// TODO coverage param applies to this, too!
singleRun: true
singleRun: config.coverage
});
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"scripts": {
"start": "webpack-dev-server --inline --config config/build/webpack.dev.js --progress --port 3000",
"test": "karma start config/test/karma.conf.js",
"coverage": "npm run lint && karma start config/test/karma.conf.js --coverage=true",
"lint": "tslint -c config/tslint.json \"src/app/**/*.ts\"",
"pretest": "npm run lint",
"build": "rimraf dist && webpack --config config/build/webpack.prod.js --progress --profile --bail"
Expand Down