diff --git a/karma.conf.js b/karma.conf.js index 16175556ae..e42e783159 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -34,6 +34,7 @@ module.exports = function(config) { // List of files / patterns to load in the browser. // By default, files are also included in a script tag. files: [ + {pattern: 'src/**/*.js', included: false}, {pattern: 'example/**/*.js', included: false}, {pattern: 'platform/**/*.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. // https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: {}, + preprocessors: { + '**/src/**/!(*Spec).js': [ 'coverage' ] + }, // Test results reporter to use // Possible values: 'dots', 'progress' // Available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress'], + reporters: ['progress', 'coverage'], // Web server port. port: 9876, @@ -71,6 +74,11 @@ module.exports = function(config) { 'Chrome' ], + // Code coverage reporting. + coverageReporter: { + dir: "target/coverage" + }, + // Continuous Integration mode. // If true, Karma captures browsers, runs the tests and exits. singleRun: false diff --git a/package.json b/package.json index e753aa7bfb..4a0523aa18 100644 --- a/package.json +++ b/package.json @@ -7,23 +7,24 @@ "minimist": "^1.1.1" }, "devDependencies": { + "canvas": "^1.2.7", + "glob": ">= 3.0.0", "jasmine-core": "^2.3.0", "jsdoc": "^3.3.2", "jshint": "^2.7.0", "karma": "^0.12.31", "karma-chrome-launcher": "^0.1.8", "karma-cli": "0.0.4", + "karma-coverage": "^0.5.3", "karma-jasmine": "^0.1.5", "karma-phantomjs-launcher": "^0.1.4", "karma-requirejs": "^0.2.2", - "requirejs": "^2.1.17", + "markdown-toc": "^0.11.7", "marked": "^0.3.5", - "glob": ">= 3.0.0", - "split": "^1.0.0", "mkdirp": "^0.5.1", "nomnoml": "^0.0.3", - "canvas": "^1.2.7", - "markdown-toc": "^0.11.7" + "requirejs": "^2.1.17", + "split": "^1.0.0" }, "scripts": { "start": "node app.js",