This repository has been archived by the owner on Apr 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkarma.conf.js
62 lines (53 loc) · 1.49 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
module.exports = function(config) {
var karmaConfig = {
frameworks: ['mocha', 'chai', 'sinon'],
// list of files / patterns to load in the browser
files: [
'./node_modules/jquery/dist/jquery.min.js',
'./node_modules/lite-fixture/index.js',
'./test/unit/**/*.spec.js'
],
client: {
mocha: {
opts: './mocha.opts'
}
},
webpack: {
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
}
]
}
},
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'./test/**/*.spec.js': config.coverage ? ['webpack'] : ['webpack', 'sourcemap']
},
browsers: [],
reporters: ['mocha'],
webpackMiddleware: {
noInfo: true
}
};
karmaConfig.browsers.push(config.chrome ? "Chrome" : "ChromeHeadless");
if(config.coverage) {
karmaConfig.reporters.push('coverage-istanbul');
karmaConfig.coverageIstanbulReporter = {
reports: ["text-summary", "html", "lcovonly"],
dir: './coverage'
};
karmaConfig.webpack.module.rules.unshift({
test: /\.js$/,
exclude: /(node_modules|test)/,
loader: 'istanbul-instrumenter-loader'
});
karmaConfig.singleRun = true;
}
config.set(karmaConfig);
};