-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathkarma.conf.js
executable file
·82 lines (76 loc) · 2.04 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
82
process.env.CHROME_BIN = require('puppeteer').executablePath()
const path = require('path')
module.exports = function (config) {
config.set({
// ... normal karma configuration
files: [
// all files ending in "_test"
{
pattern: 'test/*.js',
watched: false
}
// each file acts as entry point for the webpack configuration
],
frameworks: ['mocha'],
preprocessors: {
// add webpack as preprocessor
'test/**/*': ['webpack', 'sourcemap']
},
reporters: ['spec', 'coverage-istanbul'],
coverageIstanbulReporter: {
reports: ['text', 'json-summary', 'text-summary', 'cobertura', 'html'],
dir: path.join(__dirname, 'coverage')
},
webpack: {
// karma watches the test entry points
// (you don't need to specify the entry option)
// webpack watches dependencies
// webpack configuration
mode: 'development',
module: {
rules: [{
test: /\.tsx?$/,
use: {
loader: 'ts-loader'
},
exclude: /node_modules/
}, {
test: /\.(js|ts)x?$/,
use: {
loader: 'istanbul-instrumenter-loader',
options: {
esModules: true
}
},
enforce: 'post',
include: path.resolve('src/')
}]
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ]
}
},
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
plugins: [
require('karma-sourcemap-loader'),
require('karma-webpack'),
require('istanbul-instrumenter-loader'),
require('karma-mocha'),
require('karma-coverage'),
require('karma-coverage-istanbul-reporter'),
require('karma-spec-reporter'),
require('karma-firefox-launcher'),
require('karma-chrome-launcher')
],
webpackMiddleware: {
// webpack-dev-middleware configuration
// i. e.
stats: 'errors-only'
}
})
}