forked from naver/billboard.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
91 lines (77 loc) · 1.93 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
module.exports = function(config) {
const karmaConfig = {
frameworks: ["mocha", "chai", "sinon"],
files: [
"./node_modules/lite-fixture/index.js",
"./node_modules/hammer-simulator/index.js",
"./spec/assets/hammer-simulator.run.js",
"./spec/*-spec.js"
],
exclude: [
// "./spec/[a-b]*-spec.js"
],
client: {
mocha: {
opts: "./mocha.opts"
}
},
webpack: {
devtool: "inline-source-map",
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
presets: [
[
"es2015",
{
"loose": true,
"modules": false
}
]
],
plugins: ["add-module-exports"]
}
},
{
test: /\.scss$/,
loaders: ["style-loader", "css-loader", "sass-loader"]
}
]
}
},
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"./spec/*-spec.js": config.coverage ? ["webpack"] : ["webpack", "sourcemap"]
},
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [],
reporters: ["mocha"],
colors: true,
webpackMiddleware: {
noInfo: true
},
// https://github.com/karma-runner/karma/blob/master/docs/config/01-configuration-file.md#browsernoactivitytimeout
browserNoActivityTimeout: 50000
};
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);
};