-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.conf.js
100 lines (98 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
let coveragePreprocessors = ["karma-coverage-istanbul-instrumenter"];
let browsers = ["GCChromeHeadless"];
let flags = ['--js-flags="--expose-gc --harmony-weak-refs"'];
let singleRun = true;
if (process.argv.some(arg => arg === "--debug")) {
coveragePreprocessors = [];
browsers = ["GCChromeDebug"];
singleRun = false;
}
if (process.env.INSIDE_DOCKER) {
flags.push("--no-sandbox");
}
module.exports = function(config) {
const configuration = {
basePath: "",
frameworks: ["mocha", "chai-spies", "chai", "karma-typescript"],
files: [
{
pattern: "src/**/!(*.shared)@(.test|.spec).@(ts|mjs|js)",
type: "module",
},
{
pattern: "src/**/*.@(ts|mjs|js)",
included: false,
},
{
pattern: "tests/fixtures/*",
included: false,
},
{
pattern:
"tests/**/!(*+(.mock|.shared))@(.test|.spec).@(ts|mjs|js)",
type: "module",
},
{
pattern: "tests/**/*.@(ts|mjs|js)",
included: false,
},
],
karmaTypescriptConfig: {
bundlerOptions: {
addNodeGlobals: false,
},
coverageOptions: {
instrumentation: false,
},
tsconfig: "./tsconfig.json",
compilerOptions: {
noEmit: false,
},
},
preprocessors: {
"**/tests/*.ts": ["karma-typescript"],
"tests/setup/*.ts": ["karma-typescript"],
"src/**/*+(.test|.mock|.spec)*(.*).ts": ["karma-typescript"],
"src/!(*+(.test|.mock|.spec)*(.*)).ts": [
"karma-typescript",
...coveragePreprocessors,
],
"src/**/!(tests)/!(*+(.test|.mock|.spec)*(.*)).ts": [
"karma-typescript",
...coveragePreprocessors,
],
"src/!(*+(.test|.mock|.spec)*(.*)).@(mjs|js)": [
...coveragePreprocessors,
],
"src/**/!(tests)/!(*+(.test|.mock|.spec)*(.*)).@(mjs|js)": [
...coveragePreprocessors,
],
},
coverageIstanbulInstrumenter: {
esModules: true,
},
coverageIstanbulReporter: {
reports: ["html", "lcovonly"],
dir: "coverage",
},
reporters: ["mocha", "coverage-istanbul"],
port: 9876,
colors: true,
autoWatch: true,
singleRun,
concurrency: Infinity,
browsers,
customLaunchers: {
GCChromeHeadless: {
base: "ChromeHeadless",
flags,
},
GCChromeDebug: {
base: "Chrome",
flags,
chromeDataDir: ".chrome",
},
},
};
config.set(configuration);
};