This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
karma.conf.js
62 lines (56 loc) · 1.52 KB
/
karma.conf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* eslint-env node, es6 */
var grunt = require('grunt');
module.exports = function (config) {
var options, suffix;
suffix = process.env.UNIT_USE_NATIVE ? 'native' : 'polyfill';
if (process.env.UNIT_USE_MIN) {
suffix += '-min';
}
grunt.log.header('\n' + ('Unit tests (run: ' + suffix + ')').bold + '\n');
options = {
// To debug, run `npm run karma-debug`.
// Then press the "Debug" button in the browser window
browsers: ['ChromeHeadless'],
frameworks: ['qunit'],
client: {
clearContext: false,
qunit: {
showUI: true
}
},
files: [
'test/qunit-disable-native.js',
'test/qunit-init.js',
'src/TreeWalker-polyfill.js',
'test/TreeWalker.test.js'
],
autoWatch: false,
singleRun: true,
preprocessors: {
'src/*.js': ['coverage']
},
reporters: ['dots', 'coverage'],
coverageReporter: {
reporters: [
{ type: 'text-summary' },
{ type: 'html', dir: 'coverage/' + suffix },
{ type: 'lcovonly', dir: 'coverage/' + suffix }
]
}
};
if (process.env.UNIT_USE_NATIVE) {
options.files = options.files.filter(file => file !== 'test/qunit-disable-native.js');
options.coverageReporter.reporters = options.coverageReporter.reporters.filter(obj => {
return obj.type === 'lcovonly';
});
}
if (process.env.UNIT_USE_MIN) {
options.reporters = options.reporters.filter(val => val !== 'coverage');
options.files = options.files.map(file => {
return file === 'src/TreeWalker-polyfill.js'
? 'dist/TreeWalker-polyfill.min.js'
: file;
});
}
config.set(options);
};