-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.config.js
69 lines (68 loc) · 2.21 KB
/
karma.config.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
const webpackConfig = require('./build-config/webpack')();
const watchMode = process.env.NODE_ENV_MODE === 'test-watch';
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai', 'sinon'],
files: ['./test-config/index.js'],
preprocessors: {
'./test-config/index.js': ['webpack', 'sourcemap']
},
webpack: {
devtool: 'inline-source-map',
mode: 'development',
module: {
rules: [
...webpackConfig.module.rules,
{
test: /\.ts|js$/,
enforce: 'post',
use: {
loader: 'istanbul-instrumenter-loader',
options: { esModules: true }
},
exclude: /(_tests|test-config|types|node_modules)\//
}
]
},
resolve: webpackConfig.resolve
},
plugins: [
'karma-chrome-launcher',
'karma-chai',
'karma-mocha',
'karma-sourcemap-loader',
'karma-webpack',
'karma-mocha-reporter',
'karma-coverage-istanbul-reporter',
'karma-sinon'
],
reporters: ['mocha', 'coverage-istanbul'],
port: 2424,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
singleRun: !watchMode,
concurrency: Infinity,
coverageIstanbulReporter: {
includeAllSources: true,
fixWebpackSourcePaths: true,
dir: './coverage/',
reports: watchMode ? ['html', 'lcovonly'] : ['html', 'lcovonly', 'text'],
thresholds: watchMode
? {}
: {
emitWarning: true,
global: {
statements: 90,
lines: 90,
branches: 90,
functions: 90
}
}
},
mime: {
'text/x-typescript': ['ts', 'tsx']
}
});
};