forked from contentful/contentful-management.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.base.conf.js
63 lines (59 loc) · 1.52 KB
/
karma.base.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
const cloneDeep = require('lodash/cloneDeep')
const webpackConfig = cloneDeep(require('./webpack.config.js')[1])
delete webpackConfig.entry
delete webpackConfig.output
webpackConfig.devtool = 'inline-source-map'
const unitTestsPattern = 'test/unit/**/*-test.js'
const integrationTestsPattern = 'test/integration/**/*.test.js'
webpackConfig.node = {
fs: 'empty',
}
webpackConfig.module.rules = webpackConfig.module.rules.map((rule) => {
if (rule.loader === 'babel-loader') {
rule.options.envName = 'test'
rule.options = {
presets: [
[
'@babel/preset-env',
{
targets: {
esmodules: true,
},
},
],
'@babel/typescript',
],
}
}
return rule
})
module.exports = {
plugins: [require('karma-webpack'), require('karma-mocha'), require('karma-env-preprocessor')],
basePath: '',
frameworks: ['mocha'],
files: [
{
pattern: unitTestsPattern,
watched: false,
},
{
pattern: integrationTestsPattern,
watched: false,
},
],
envPreprocessor: ['API_INTEGRATION_TESTS', 'CONTENTFUL_INTEGRATION_TEST_CMA_TOKEN'],
preprocessors: {
[unitTestsPattern]: ['webpack', 'env'],
[integrationTestsPattern]: ['webpack', 'env'],
},
webpack: webpackConfig,
browserDisconnectTolerance: 5,
browserNoActivityTimeout: 4 * 60 * 1000,
browserDisconnectTimeout: 10000,
captureTimeout: 4 * 60 * 1000,
reporters: ['dots'],
port: 9876,
colors: true,
autoWatch: false,
singleRun: true,
}