Skip to content

Commit

Permalink
build(coverage): enable dev js code coverage
Browse files Browse the repository at this point in the history
  Adds the following npm devDependencies
    - karma-coverage
    - rimraf
  Adds the following npm scripts both convienence items
    - postinstall: installs typings & runs npm prune
    - reinstall: cleans cache, generated content node_modules & runs reinstall
  Enables JavaScript coverage reporting with multiple outputs
    - Reports code coverage at the commandline
    - Generates an HTML coverage report
    - Generates a coverage.json for future coverage history
  • Loading branch information
joshwiens committed Mar 9, 2016
1 parent 425db8a commit bcb3dfb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"karma": "^0.13.15",
"karma-browserstack-launcher": "^0.1.7",
"karma-chrome-launcher": "^0.2.1",
"karma-coverage": "^0.5.5",
"karma-dart": "^0.3.0",
"karma-firefox-launcher": "^0.1.7",
"karma-jasmine": "^0.3.6",
Expand Down
18 changes: 15 additions & 3 deletions test/karma.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export function config(config) {
frameworks: ['jasmine'],
plugins: [
require('karma-jasmine'),
require('karma-coverage'),
require('karma-browserstack-launcher'),
require('karma-sauce-launcher'),
require('karma-chrome-launcher'),
Expand Down Expand Up @@ -57,13 +58,24 @@ export function config(config) {
customLaunchers: customLaunchers,

exclude: [],
preprocessors: {},
reporters: ['dots'],
preprocessors: {
'dist/**/!(*spec).js': ['coverage']
}
reporters: ['dots', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,

coverageReporter: {
dir: 'coverage/',
reporters: [
{ type: 'text-summary' },
{ type: 'json', subdir: '.', file: 'coverage-final.json' },
{ type: 'html' }
]
},

sauceLabs: {
testName: 'material2',
startConnect: false,
Expand All @@ -89,7 +101,7 @@ export function config(config) {
browserNoActivityTimeout: 100000,
browsers: ['Chrome'],

singleRun: false
singleRun: true
});

if (process.env['TRAVIS']) {
Expand Down

0 comments on commit bcb3dfb

Please sign in to comment.