-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
60 lines (56 loc) · 1.85 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
const { BrowserFetcher } = require("puppeteer");
const { createTestConfiguration } = require("./webpack.config");
async function fetchChrome() {
const ChromiumRevision = require('puppeteer-core/lib/cjs/puppeteer/revisions.js').PUPPETEER_REVISIONS.chromium;
const browserFetcher = new BrowserFetcher({path: './temp/browser',product: "chrome"});
const revisionInfo = await browserFetcher.download(ChromiumRevision);
process.env.CHROME_BIN = revisionInfo.executablePath
}
module.exports = async function (config) {
await fetchChrome();
config.set({
basePath: '',
exclude: [],
files: [
{ pattern: '**/spec.js', watched: true, served: true, included: true }
],
autoWatch: true,
singleRun: true,
failOnEmptyTestSuite: false,
logLevel: config.LOG_WARN,
plugins: ["karma-webpack", "karma-jasmine", "karma-chrome-launcher"],
frameworks: ['jasmine', "webpack"],
browsers: ['puppeteerChrome'],
customLaunchers: {
puppeteerChrome: {
base: "ChromeHeadless",
flags: ["--disable-extensions","--no-sandbox"],
}
},
retryLimit: 0,
browserDisconnectTimeout: 15000,
browserNoActivityTimeout: 30000,
captureTimeout: 60000,
client: {
captureConsole: false,
clearContext: false,
runInParent: false,
useIframe: true,
jasmine: {
random: false
}
},
webpack: createTestConfiguration(),
preprocessors: {
'**/spec.js': ['webpack'],
'**/spec.ts': ['webpack']
},
webpackMiddleware: {
noInfo: true,
stats: 'errors-only'
},
mochaReporter: {
output: 'noFailures'
}
});
};