2017-03-04 16:47:53 +01:00
|
|
|
/* eslint camelcase: 0 */
|
|
|
|
|
|
|
|
module.exports = function(karma) {
|
2017-03-25 18:26:45 +01:00
|
|
|
var args = karma.args || {};
|
2017-03-04 16:47:53 +01:00
|
|
|
var config = {
|
|
|
|
browsers: ['Firefox'],
|
2016-02-14 03:58:49 +01:00
|
|
|
frameworks: ['browserify', 'jasmine'],
|
2017-03-04 16:47:53 +01:00
|
|
|
reporters: ['progress', 'kjhtml'],
|
2016-02-14 03:58:49 +01:00
|
|
|
|
|
|
|
preprocessors: {
|
2017-03-04 16:47:53 +01:00
|
|
|
'./test/jasmine.index.js': ['browserify'],
|
|
|
|
'./src/**/*.js': ['browserify']
|
2016-02-14 03:58:49 +01:00
|
|
|
},
|
2017-03-04 16:47:53 +01:00
|
|
|
|
2016-02-14 03:58:49 +01:00
|
|
|
browserify: {
|
|
|
|
debug: true
|
2017-10-22 17:32:39 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
// These settings deal with browser disconnects. We had seen test flakiness from Firefox
|
|
|
|
// [Firefox 56.0.0 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
|
|
|
|
// https://github.com/jasmine/jasmine/issues/1327#issuecomment-332939551
|
|
|
|
browserDisconnectTolerance: 3
|
2017-03-04 16:47:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// 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');
|
|
|
|
}
|
|
|
|
|
2017-03-25 18:26:45 +01:00
|
|
|
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'}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-03-04 16:47:53 +01:00
|
|
|
karma.set(config);
|
|
|
|
};
|