-
Notifications
You must be signed in to change notification settings - Fork 69
/
karma.conf.js
102 lines (92 loc) · 2.97 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
98
99
100
101
102
const webpackConfig = require("./config/webpack.config.test");
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
// Only enable coverage if env is defined(So we don't enable it in watch mode as it duplicate logs)
const coverageReporters = process.env.COVERAGE ? ["coverage", "junit"] : [];
// Karma config for testing the code running the browser environemnt.
// For the client testing use the mocha command line.
module.exports = function(config) {
config.set({
basePath: ".",
frameworks: ["jasmine"],
files: [
{
pattern: "./test/app/spec-entry.js",
watched: false
},
{
pattern: "./src/test/fixtures/**/*",
watched: false,
included: false,
served: true,
// Important, if karma cache the encoding files it will remove the BOM which fails the tests
nocache: true,
}
],
// proxied base paths
proxies: {
"/fixtures/": "/base/src/test/fixtures/"
},
port: 9876,
logLevel: config.LOG_INFO,
browserConsoleLogOptions: {
level: "log",
},
colors: true,
autoWatch: false,
autoWatchBatchDelay: 1000,
browsers: ["CustomElectron"],
browserNoActivityTimeout: 3000000,
customLaunchers: {
CustomElectron: {
base: "Electron",
flags: ["--enable-precise-memory-info"],
browserWindowOptions: {
show: true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
}
}
}
},
electronOpts: {
title: "Banana",
"webPreferences": {
"blinkFeatures": "PreciseMemoryInfo",
}
},
// Coverage reporter generates the coverage
reporters: ["mocha", ...coverageReporters],
preprocessors: {
"test/app/spec-entry.js": ["coverage", "webpack", "sourcemap"],
},
client: {
useIframe: false,
jasmine: {
random: false,
},
},
webpack: webpackConfig,
webpackMiddleware: {
stats: "errors-only",
},
browserDisconnectTimeout: "4000",
singleRun: true,
mochaReporter: {
output: "autowatch",
reportSlowerThan: 200,
},
coverageReporter: {
dir: "./coverage",
reporters: [
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "html", subdir: "./html" },
{ type: "cobertura", subdir: ".", file: "cobertura.xml" },
]
},
junitReporter: {
outputDir: "./coverage"
}
});
};