-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
97 lines (93 loc) · 3.02 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
const globby = require('globby');
const puppeteer = require('puppeteer');
process.env.CHROME_BIN = puppeteer.executablePath();
const basePlugins = [
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-object-rest-spread',
'source-map-support'
];
const files = globby.sync([ 'test/**/*.test.js' ]);
module.exports = function (config) {
config.set({
frameworks: [ 'mocha' ],
browsers : [ 'ChromeHeadless', /* 'Firefox' , 'Edge' */ ],
preprocessors: {
'test/**/*.test.js': [ 'webpack', 'sourcemap' ]
},
reporters: [ 'spec', 'coverage' ],
coverageReporter: {
dir: 'coverage/',
reporters: [
{ type: 'html' },
{ type: 'text' },
{ type: 'text-summary' }
],
instrumenterOptions: {
istanbul: { noCompact: true }
}
},
webpack: {
output: {
libraryTarget: 'umd',
libraryExport: 'default',
umdNamedDefine: true
},
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.js$/,
exclude: /(test|node_modules|bower_components)/,
loader: 'babel-loader',
options: {
presets: [
['@babel/env', {
targets: {
browsers: [
'>0.25%',
'not dead'
]
}
}]
],
plugins: [
...basePlugins,
"istanbul"
]
},
}
]
},
resolve: {
modules: [
'node_modules',
'src'
],
},
mode: process.env.NODE_ENV || 'development',
target: 'web',
node: {
fs: "empty",
module: "empty"
}
},
webpackMiddleware: {
noInfo: true
},
plugins: [
require("karma-webpack"),
require("istanbul-instrumenter-loader"),
require("karma-mocha"),
require("karma-coverage"),
require("karma-chrome-launcher"),
require("karma-spec-reporter"),
require('karma-sourcemap-loader'),
require('karma-coverage-istanbul-reporter'),
require('karma-firefox-launcher'),
require('karma-edge-launcher')
],
files
});
};