-
Notifications
You must be signed in to change notification settings - Fork 281
/
karma.conf.cjs
110 lines (91 loc) · 2.58 KB
/
karma.conf.cjs
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
'use strict';
/* eslint-env node */
const commonjs = require('@rollup/plugin-commonjs');
const resolve = require('@rollup/plugin-node-resolve').nodeResolve;
const babel = require('@rollup/plugin-babel');
const json = require('@rollup/plugin-json');
module.exports = function(config) {
// Karma configuration
config.set({
// The root path location that will be used to resolve all relative paths
// defined in 'files' and 'exclude'.
basePath: '',
frameworks: ['mocha', 'chai-sinon'],
client: {
chai: {
includeStack: true
},
mocha: {
timeout: 10000
}
},
// list of files / patterns to load in the browser
files: [
{ pattern: 'test/data/*', included: false },
{ pattern: 'test/tests.js', type: 'module', included: true }
],
mime: {
'application/octet-stream': ['dat']
},
preprocessors: {
'test/tests.js': ['rollup']
},
rollupPreprocessor: {
plugins: [
commonjs(),
json(),
resolve({ browser: true }),
babel.babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
plugins: ['istanbul']
})
],
output: {
format: 'iife',
name: 'peaks',
sourcemap: 'inline'
}
},
// test results reporter to use
// possible values: dots || progress || growl || spec
reporters: ['spec', 'coverage'],
// configure the test coverage reporter
coverageReporter: {
reporters: [
{ type: 'html', dir: 'coverage', subdir: '.' },
{ type: 'text' },
{ type: 'text-summary' }
]
},
// web server port
port: 8080,
// CLI runner port
runnerPort: 9100,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
customLaunchers: {
ChromeHeadlessWithoutAutoplayPolicy: {
base: 'ChromeHeadless',
flags: ['--autoplay-policy=no-user-gesture-required']
},
FirefoxHeadless: {
base: 'Firefox',
flags: ['-headless']
}
},
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 120000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true
});
config.set({
browsers: ['ChromeHeadlessWithoutAutoplayPolicy']
});
};