forked from contentful/contentful.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.base.conf.js
54 lines (46 loc) · 1.32 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
// This file is just a base configuration for karma and not directly usable
// Use karma.conf.local.js for local tests
// Use karma.conf.saucelabs.js for saucelabs tests
const copy = require('fast-copy').default
const webpackConfig = copy(require('./webpack.config.js')[1])
delete webpackConfig.entry
delete webpackConfig.output
webpackConfig.devtool = 'inline-source-map'
// https://webpack.github.io/docs/configuration.html#node
// https://rmurphey.com/blog/2015/07/20/karma-webpack-tape-code-coverage
webpackConfig.node = {
fs: 'empty'
}
webpackConfig.module.rules = webpackConfig.module.rules.map((rule) => {
if (rule.loader === 'babel-loader') {
rule.options.envName = 'test'
}
return rule
})
console.log('Karma webpack config:')
console.log(JSON.stringify(webpackConfig, null, 2))
module.exports = {
plugins: [
require('karma-tap'),
require('karma-webpack')
],
basePath: '',
frameworks: ['tap'],
files: [
'test/runner-browser.js'
],
preprocessors: {
'test/runner-browser.js': ['webpack'],
'test/unit/**/*.js': ['webpack']
},
webpack: webpackConfig,
browserDisconnectTolerance: 5,
browserNoActivityTimeout: 4 * 60 * 1000,
browserDisconnectTimeout: 10000,
captureTimeout: 4 * 60 * 1000,
reporters: ['dots'],
port: 9876,
colors: true,
autoWatch: false,
singleRun: true
}