-
Notifications
You must be signed in to change notification settings - Fork 106
/
karma.conf.js
74 lines (66 loc) · 2.13 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
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular', 'detectBrowsers'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-firefox-launcher'),
require('karma-safari-launcher'),
require('karma-detect-browsers'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
coverageReporter: {
dir: require('path').join(__dirname, './coverage'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' },
{ type: 'lcovonly' }
],
fixWebpackSourcePaths: true,
thresholds: {
statements: 80,
lines: 80,
branches: 80,
functions: 80
}
},
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
},
ChromiumHeadlessNoSandbox: {
base: 'ChromiumHeadless',
flags: ['--no-sandbox']
}
},
detectBrowsers: {
// enable/disable, default is true
enabled: true,
// enable/disable phantomjs support, default is true
usePhantomJS: false,
// use headless mode, for browsers that support it, default is false
preferHeadless: true,
postDetection: function (availableBrowsers) {
// ChromeHeadless -> ChromeHeadlessNoSandbox
if (availableBrowsers.includes('ChromeHeadless')) {
const index = availableBrowsers.indexOf('ChromeHeadless');
availableBrowsers[index] = 'ChromeHeadlessNoSandbox';
}
// ChromiumHeadless -> ChromiumHeadlessNoSandbox
if (availableBrowsers.includes('ChromiumHeadless')) {
const index = availableBrowsers.indexOf('ChromiumHeadless');
availableBrowsers[index] = 'ChromiumHeadlessNoSandbox';
}
return availableBrowsers;
}
},
singleRun: true
});
};