-
Notifications
You must be signed in to change notification settings - Fork 48
/
karma.config.cjs
75 lines (67 loc) · 2.08 KB
/
karma.config.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
module.exports = async config => {
const rollup = await import('./rollup.config.js');
return config.set({
basePath: process.cwd(),
frameworks: ['jasmine'],
reporters: ['mocha'],
singleRun: true,
concurrency: 1,
browsers: [
'ChromeHeadless',
'FirefoxHeadless'
],
files: [
// common files
{ pattern: require.resolve('regenerator-runtime/runtime'), watched: false },
{ pattern: require.resolve('./scripts/test-helpers'), type: 'module', watched: false },
// local package files
{ pattern: 'src/index.js', type: 'module', watched: false },
{ pattern: 'test/helpers.js', type: 'module', watched: false },
{ pattern: 'test/**/*.test.js', type: 'module', watched: false },
{ pattern: 'test/assets/**', watched: false, included: false }
],
// NOTE: Although sdk-utils test run in browser as well, we do not run sdk-utils/request test in browsers as we require creation of https server for this test
exclude: [
'**/test/request.test.js',
],
proxies: {
// useful when the contents of a fake asset do not matter
'/_/': 'localhost/'
},
// create dedicated bundles for src, test helpers, and each test suite
preprocessors: {
'src/index.js': ['rollup'],
'test/helpers.js': ['rollupTestHelpers'],
'test/**/*.test.js': ['rollupTestFiles']
},
client: {
env: {
// used in the test helper to add failed test debug logs
DUMP_FAILED_TEST_LOGS: process.env.DUMP_FAILED_TEST_LOGS
},
// reports look better when not randomized
jasmine: {
random: false
}
},
// (see rollup.config.js)
rollupPreprocessor: rollup.test,
customPreprocessors: {
rollupTestHelpers: {
base: 'rollup',
options: rollup.testHelpers
},
rollupTestFiles: {
base: 'rollup',
options: rollup.testFiles
}
},
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-mocha-reporter',
'karma-rollup-preprocessor'
]
});
};