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

Commit

Permalink
Merge pull request #10 from Tynarus/coverage-flag
Browse files Browse the repository at this point in the history
Adding new 'coverage' command to run unit test coverage reporting, re…
  • Loading branch information
Tynarus committed Sep 12, 2017
2 parents 5f18da0 + 18013b0 commit 3c0c3b4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
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

0 comments on commit 3c0c3b4

Please sign in to comment.