03258a61c2
This patch enables code coverage reporting during unit tests via the `karma-coverage` plugin, and writes them in HTML form to the `cover` directory where they can be collected as part of the test job output. Change-Id: Ic280664eaf5d5f85acfaeb3f54b314129e9ed786
76 lines
1.3 KiB
JavaScript
76 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
var istanbul = require('browserify-istanbul');
|
|
var isparta = require('isparta');
|
|
|
|
module.exports = function(config) {
|
|
config.set({
|
|
|
|
basePath: '../',
|
|
|
|
frameworks: ['jasmine', 'browserify'],
|
|
|
|
files: [
|
|
// app-specific code
|
|
'app/js/main.js',
|
|
// 3rd-party resources
|
|
'node_modules/angular-mocks/angular-mocks.js',
|
|
// test files
|
|
'test/unit/**/*.js'
|
|
],
|
|
|
|
preprocessors: {
|
|
'app/js/**/*.js': ['browserify', 'babel', 'coverage']
|
|
},
|
|
|
|
reporters: ['spec', 'coverage'],
|
|
|
|
port: 9876,
|
|
|
|
colors: false,
|
|
|
|
logLevel: config.LOG_INFO,
|
|
|
|
autoWatch: true,
|
|
|
|
browsers: ['PhantomJS'],
|
|
|
|
singleRun: true,
|
|
|
|
plugins: [
|
|
'karma-babel-preprocessor',
|
|
'karma-browserify',
|
|
'karma-coverage',
|
|
'karma-jasmine',
|
|
'karma-spec-reporter',
|
|
'karma-phantomjs-launcher'
|
|
],
|
|
|
|
browserify: {
|
|
debug: true,
|
|
transform: [
|
|
'bulkify',
|
|
istanbul({
|
|
instrumenter: isparta,
|
|
ignore: ['**/node_modules/**', '**/test/**']
|
|
})
|
|
]
|
|
},
|
|
|
|
coverageReporter: {
|
|
type: 'html',
|
|
dir: 'cover',
|
|
instrumenterOptions: {
|
|
istanbul: {noCompact: true}
|
|
}
|
|
},
|
|
|
|
proxies: {
|
|
'/': 'http://localhost:9876/'
|
|
},
|
|
|
|
urlRoot: '/__karma__/'
|
|
});
|
|
|
|
};
|