mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
2dbf1cd1af
JSON doesn't support functions which are needed to create scriptable options, so implement a very basic method to load a JavaScript file exporting the config in `module.exports`. Also rename test sources (remove the `jasmine.` prefix), cleanup `karma.conf.js` and add an example .js fixture config (bubble radius option).
73 lines
1.9 KiB
JavaScript
73 lines
1.9 KiB
JavaScript
/* eslint camelcase: 0 */
|
|
|
|
module.exports = function(karma) {
|
|
var args = karma.args || {};
|
|
var config = {
|
|
frameworks: ['browserify', 'jasmine'],
|
|
reporters: ['progress', 'kjhtml'],
|
|
browsers: ['chrome', 'firefox'],
|
|
|
|
// Explicitly disable hardware acceleration to make image
|
|
// diff more stable when ran on Travis and dev machine.
|
|
// https://github.com/chartjs/Chart.js/pull/5629
|
|
customLaunchers: {
|
|
chrome: {
|
|
base: 'Chrome',
|
|
flags: [
|
|
'--disable-accelerated-2d-canvas'
|
|
]
|
|
},
|
|
firefox: {
|
|
base: 'Firefox',
|
|
prefs: {
|
|
'layers.acceleration.disabled': true
|
|
}
|
|
}
|
|
},
|
|
|
|
files: [
|
|
{pattern: 'test/fixtures/**/*.js', included: false},
|
|
{pattern: 'test/fixtures/**/*.json', included: false},
|
|
{pattern: 'test/fixtures/**/*.png', included: false},
|
|
'node_modules/moment/min/moment.min.js',
|
|
'test/index.js',
|
|
'src/**/*.js'
|
|
].concat(args.inputs),
|
|
|
|
preprocessors: {
|
|
'test/index.js': ['browserify'],
|
|
'src/**/*.js': ['browserify']
|
|
},
|
|
|
|
browserify: {
|
|
debug: true
|
|
},
|
|
|
|
// 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
|
|
};
|
|
|
|
// https://swizec.com/blog/how-to-run-javascript-tests-in-chrome-on-travis/swizec/6647
|
|
if (process.env.TRAVIS) {
|
|
config.customLaunchers.chrome.flags.push('--no-sandbox');
|
|
}
|
|
|
|
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);
|
|
};
|