-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
49 lines (45 loc) · 1.22 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
module.exports = function(config) {
const karmaConfig = {
frameworks: ["mocha", "karma-typescript"],
files: ["./test/**/*.spec.ts"],
client: {
mocha: {
opts: "./mocha.opts",
},
},
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"./test/**/*.spec.ts": ["karma-typescript"],
},
karmaTypescriptConfig: {
compilerOptions: {
lib: ["dom", "es6", "es5"],
},
},
browsers: [],
// you can define custom flags
customLaunchers: {
CustomChromeHeadless: {
base: "ChromeHeadless",
flags: ["--window-size=400,300", "--no-sandbox", "--disable-setuid-sandbox"],
},
},
reporters: ["mocha"],
};
karmaConfig.browsers.push(config.chrome ? "Chrome" : "CustomChromeHeadless");
if (config.coverage) {
karmaConfig.reporters.push("coverage-istanbul");
karmaConfig.coverageIstanbulReporter = {
reports: ["text-summary", "html", "lcovonly"],
dir: "./coverage",
};
karmaConfig.webpack.module.rules.unshift({
test: /\.ts$/,
exclude: /(node_modules|test)/,
loader: "istanbul-instrumenter-loader",
});
karmaConfig.singleRun = true;
}
config.set(karmaConfig);
};