-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathkarma.browser.esnext.conf.js
More file actions
89 lines (84 loc) · 2.83 KB
/
karma.browser.esnext.conf.js
File metadata and controls
89 lines (84 loc) · 2.83 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 path = require('path');
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: [ "ChromeHeadlessNoSandbox" ],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
flags: [
"--no-sandbox",
"--disable-gpu",
"--disable-web-security",
"--disable-dev-shm-usage"
]
}
},
listenAddress: 'localhost',
hostname: 'localhost',
frameworks: [ "mocha", "karma-typescript" ],
files: [
{ pattern: "lib/src/**/*.ts" },
{ pattern: "lib/test/src/browser/**/*.ts" },
{ pattern: "lib/test/src/common/**/*.ts" },
{ pattern: "lib/test/src/esnext/**/*.ts" }
],
preprocessors: {
"lib/src/**/*.ts": [ "karma-typescript" ],
"lib/test/src/**/*.ts": [ "karma-typescript" ]
},
karmaTypescriptConfig: {
tsconfig: "./lib/test/tsconfig.test.karma.json",
compilerOptions: {
target: "ESNext",
sourceMap: true
},
bundlerOptions: {
sourceMap: true
},
coverageOptions: {
instrumentation: true,
sourceMap: true,
exclude: [
/\.(d|spec|test)\.ts$/i,
/index.ts$/i,
/polyfills.ts$/i
]
},
reports: {
"html-spa": {
"directory": "./coverage",
"subdirectory": "browser_esnext"
},
"json": {
"directory": "./coverage",
"subdirectory": "browser_esnext",
"filename": "coverage-final.json"
},
"text": ""
}
},
reporters: [ "spec", "karma-typescript" ],
logLevel: config.LOG_INFO
})
};