-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathkarma.conf.js
81 lines (73 loc) · 2.02 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
module.exports = function (config) {
config.set({
files: [
{ pattern: 'test/**/*.spec.js' }
],
frameworks: ['mocha'],
plugins: [
require('karma-rollup-preprocessor'),
require('karma-mocha'),
require('karma-chrome-launcher'),
require('karma-firefox-launcher'),
...(process.env.COVERAGE ? [require('karma-coverage')] : [])
],
reporters: [
'progress',
...(process.env.COVERAGE ? ['coverage'] : [])
],
preprocessors: {
'test/**/*.spec.js': ['rollup']
},
...(process.env.COVERAGE && {
coverageReporter: {
dir: 'coverage',
reporters: [
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'report-lcov' },
{ type: 'text', subdir: 'report-text' }
],
check: {
global: {
statements: 100,
branches: 100,
functions: 100,
lines: 100
}
}
}
}),
rollupPreprocessor: {
plugins: [
require('@rollup/plugin-node-resolve').default({
mainFields: ['browser', 'module', 'main'],
preferBuiltins: false
}),
require('@rollup/plugin-commonjs')(),
require('rollup-plugin-node-globals')(),
require('rollup-plugin-string').string({
include: '**/*.html'
}),
...(process.env.COVERAGE
? [require('rollup-plugin-istanbul')({
exclude: ['**/test/**', '**/node_modules/**']
})]
: [])
],
output: {
format: 'iife', // Helps prevent naming collisions.
name: 'Test', // Required for 'iife' format.
sourcemap: 'inline' // Sensible for testing.
}
},
browsers: [
'ChromeHeadless',
'FirefoxHeadless'
]
})
}