forked from sijakret/lit-transition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
83 lines (72 loc) · 1.96 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
83
const webpack = require('./webpack.config');
const webpackMerge = require('webpack-merge');
const path = require('path');
// delete entry from webpack
delete webpack.entry;
module.exports = (config) => {
config.set({
browsers: [
'ChromeHeadless'
],
files: [
'test/index.js'
],
// frameworks to use
frameworks: ['mocha'],
plugins: [
require("karma-webpack"),
require("istanbul-instrumenter-loader"),
require("karma-mocha"),
require("karma-coverage"),
require("karma-chrome-launcher"),
require("karma-spec-reporter"),
require("karma-coverage-istanbul-reporter"),
require("karma-sourcemap-loader")
],
reporters: [
'spec',
'coverage-istanbul'
],
client: {
mocha: {
// change Karma's debug.html to the mocha web reporter
reporter: 'html',
ui: 'tdd',
}
},
preprocessors: {
// add webpack as preprocessor
'test/**/*': ['webpack','coverage','sourcemap'],
},
coverageIstanbulReporter: {
// reports can be any that are listed here: https://github.com/istanbuljs/istanbuljs/tree/aae256fb8b9a3d19414dcf069c592e88712c32c6/packages/istanbul-reports/lib
reports: ['html', 'lcovonly', 'text-summary'],
// base output directory. If you include %browser% in the path it will be replaced with the karma browser name
dir: path.join(__dirname, 'coverage'),
},
webpack: webpackMerge(webpack, {
module: {
rules: [
{
enforce: 'post',
test: /\.ts$/,
include: [
path.resolve(__dirname, "src")
],
use: {
loader: 'istanbul-instrumenter-loader',
options: {
esModules: true
}
}
}
],
}
}),
webpackMiddleware: {
// webpack-dev-middleware configuration
// i. e.
stats: 'errors-only',
},
});
};