-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathkarma.worker.conf.js
More file actions
89 lines (82 loc) · 2.92 KB
/
karma.worker.conf.js
File metadata and controls
89 lines (82 loc) · 2.92 KB
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
const childProcess = require('child_process');
function _resolvePuppeteerExecutablePathSync() {
return childProcess.execFileSync(process.execPath, [
"-e",
"require('puppeteer').executablePath().then((path) => process.stdout.write(path || ''))"
], {
encoding: "utf8"
}).trim();
}
module.exports = function (config) {
// Puppeteer v25+ resolves executablePath asynchronously, so resolve it in a subprocess
// to keep this Karma config synchronous.
try {
const chromePath = _resolvePuppeteerExecutablePathSync();
if (chromePath) {
process.env.CHROME_BIN = chromePath;
process.env.CHROMIUM_BIN = chromePath;
}
} catch (error) {
console.warn("Puppeteer executable path could not be resolved. Chrome/Chromium tests may be skipped.");
process.exit(0);
}
config.set({
browsers: ["Chromium_without_security"],
listenAddress: "localhost",
hostname: "localhost",
frameworks: ["mocha", "karma-typescript"],
files: [
{ pattern: "lib/src/**/*.ts" },
{ pattern: "common/test/worker-adapter.js" },
{ pattern: "lib/test/src/!(browser|node|esnext)/**/*.ts" },
{ pattern: "common/test/worker-test-runner.js", included: false, served: true, watched: false }
],
preprocessors: {
"lib/src/**/*.ts": ["karma-typescript"],
"lib/test/src/**/*.ts": ["karma-typescript"]
},
karmaTypescriptConfig: {
tsconfig: "./lib/test/tsconfig.worker.karma.json",
compilerOptions: {
sourceMap: false,
inlineSourceMap: false,
inlineSources: false,
module: "commonjs"
},
bundlerOptions: {
sourceMap: false
},
coverageOptions: {
instrumentation: true,
exclude: [
/\.(d|spec|test)\.ts$/i,
/index\.ts$/i,
/checkError\.ts$/i,
/\/node_modules\//i
]
},
reports: {
"html": {
"directory": "./coverage/worker",
"subdirectory": "./html"
},
"json": {
"directory": "./coverage/worker",
"subdirectory": "./",
"filename": "coverage-final.json"
},
"text": ""
}
},
reporters: ["spec", "karma-typescript"],
customLaunchers: {
Chromium_without_security: {
base: "ChromeHeadless",
flags: ["--disable-web-security", "--disable-site-isolation-trials", "--no-sandbox"]
}
},
logLevel: config.LOG_INFO,
captureTimeout: 60000,
browserNoActivityTimeout: 60000
});
};