Chart.js/karma.conf.js
Simon Brunel e3f3b8978b Add gulp unittest --coverage argument (#4075)
Coverage data are now generated by running `gulp unittest` with the `--coverage` argument: unit tests are then executed a single time on Travis. The gulp `coverage` task has been removed and `karma.coverage.conf.ci.js` merged into `karma.conf.ci.js`.

Update documentation with gulp commands (and remove them from `README.md`) and remove unused `config.jshintrc` (oversight from #3256). Delete `thankyou.md` which has been merged into `README.md`.
2017-03-25 18:26:45 +01:00

49 lines
1.1 KiB
JavaScript

/* eslint camelcase: 0 */
module.exports = function(karma) {
var args = karma.args || {};
var config = {
browsers: ['Firefox'],
frameworks: ['browserify', 'jasmine'],
reporters: ['progress', 'kjhtml'],
preprocessors: {
'./test/jasmine.index.js': ['browserify'],
'./src/**/*.js': ['browserify']
},
browserify: {
debug: true
}
};
// https://swizec.com/blog/how-to-run-javascript-tests-in-chrome-on-travis/swizec/6647
if (process.env.TRAVIS) {
config.browsers.push('chrome_travis_ci');
config.customLaunchers = {
chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
};
} else {
config.browsers.push('Chrome');
}
if (args.coverage) {
config.reporters.push('coverage');
config.browserify.transform = ['browserify-istanbul'];
// https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md
config.coverageReporter = {
dir: 'coverage/',
reporters: [
{type: 'html', subdir: 'report-html'},
{type: 'lcovonly', subdir: '.', file: 'lcov.info'}
]
};
}
karma.set(config);
};