-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
71 lines (68 loc) · 2.14 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
// 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: ['waitwebpack', 'jasmine', '@angular-devkit/build-angular'],
middleware: ['fake-url'],
plugins: [
// Tell karma to wait for bundle to be completed before launching browsers.
// See: https://github.com/karma-runner/karma-chrome-launcher/issues/154#issuecomment-986661937
require('./config/plugins/karma.waitwebpack'),
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();
};
},
],
},
],
client: {
jasmine: {
random: false,
},
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
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,
};
};