[API] Enable code coverage

Enable code coverage reporting from npm-executed tests.
This commit is contained in:
Victor Woeltjen 2016-01-08 12:06:12 -08:00
parent 72c721b605
commit 39c1a885d8
2 changed files with 16 additions and 7 deletions

View File

@ -34,6 +34,7 @@ module.exports = function(config) {
// List of files / patterns to load in the browser. // List of files / patterns to load in the browser.
// By default, files are also included in a script tag. // By default, files are also included in a script tag.
files: [ files: [
{pattern: 'src/**/*.js', included: false},
{pattern: 'example/**/*.js', included: false}, {pattern: 'example/**/*.js', included: false},
{pattern: 'platform/**/*.js', included: false}, {pattern: 'platform/**/*.js', included: false},
{pattern: 'warp/**/*.js', included: false}, {pattern: 'warp/**/*.js', included: false},
@ -47,12 +48,14 @@ module.exports = function(config) {
// Preprocess matching files before serving them to the browser. // Preprocess matching files before serving them to the browser.
// https://npmjs.org/browse/keyword/karma-preprocessor // https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {}, preprocessors: {
'**/src/**/!(*Spec).js': [ 'coverage' ]
},
// Test results reporter to use // Test results reporter to use
// Possible values: 'dots', 'progress' // Possible values: 'dots', 'progress'
// Available reporters: https://npmjs.org/browse/keyword/karma-reporter // Available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'], reporters: ['progress', 'coverage'],
// Web server port. // Web server port.
port: 9876, port: 9876,
@ -71,6 +74,11 @@ module.exports = function(config) {
'Chrome' 'Chrome'
], ],
// Code coverage reporting.
coverageReporter: {
dir: "target/coverage"
},
// Continuous Integration mode. // Continuous Integration mode.
// If true, Karma captures browsers, runs the tests and exits. // If true, Karma captures browsers, runs the tests and exits.
singleRun: false singleRun: false

View File

@ -7,23 +7,24 @@
"minimist": "^1.1.1" "minimist": "^1.1.1"
}, },
"devDependencies": { "devDependencies": {
"canvas": "^1.2.7",
"glob": ">= 3.0.0",
"jasmine-core": "^2.3.0", "jasmine-core": "^2.3.0",
"jsdoc": "^3.3.2", "jsdoc": "^3.3.2",
"jshint": "^2.7.0", "jshint": "^2.7.0",
"karma": "^0.12.31", "karma": "^0.12.31",
"karma-chrome-launcher": "^0.1.8", "karma-chrome-launcher": "^0.1.8",
"karma-cli": "0.0.4", "karma-cli": "0.0.4",
"karma-coverage": "^0.5.3",
"karma-jasmine": "^0.1.5", "karma-jasmine": "^0.1.5",
"karma-phantomjs-launcher": "^0.1.4", "karma-phantomjs-launcher": "^0.1.4",
"karma-requirejs": "^0.2.2", "karma-requirejs": "^0.2.2",
"requirejs": "^2.1.17", "markdown-toc": "^0.11.7",
"marked": "^0.3.5", "marked": "^0.3.5",
"glob": ">= 3.0.0",
"split": "^1.0.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"nomnoml": "^0.0.3", "nomnoml": "^0.0.3",
"canvas": "^1.2.7", "requirejs": "^2.1.17",
"markdown-toc": "^0.11.7" "split": "^1.0.0"
}, },
"scripts": { "scripts": {
"start": "node app.js", "start": "node app.js",