-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathkarma.conf.js
More file actions
83 lines (80 loc) · 2.46 KB
/
karma.conf.js
File metadata and controls
83 lines (80 loc) · 2.46 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
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const { join } = require('path');
const { constants } = require('karma');
module.exports = () => {
return {
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
middleware: ['fake-url'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'),
{
'middleware:fake-url': [
'factory',
function () {
// Middleware that avoids triggering 404s during tests that need to reference
// image paths. Assumes that the image path will start with `/$`.
// Credit: https://github.com/angular/components/blob/59002e1649123922df3532f4be78c485a73c5bc1/test/karma.conf.js
return function (request, response, next) {
if (request.url.indexOf('/$') === 0) {
response.writeHead(200);
return response.end();
}
next();
};
},
],
},
],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: [
'--headless=new',
'--window-size=1920,1080',
// By default, Chrome throttles timers (setTimeout, setInterval),
// requestAnimationFrame, and other scheduled work in windows covered by
// other windows. This flag disables that behavior so tests relying on
// timers, animations, or Angular change detection run at full speed and
// don't produce flaky timeouts in CI environments.
'--disable-backgrounding-occluded-windows',
],
},
},
restartOnFileChange: true,
client: {
jasmine: {
random: false,
},
},
coverageReporter: {
dir: join(__dirname, './coverage'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'json-summary' },
{ type: 'text-summary' },
{ type: 'lcov', subdir: 'lcov-report' },
],
check: {
global: {
statements: 100,
branches: 100,
functions: 100,
lines: 100,
},
},
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: constants.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: true,
};
};