-
Notifications
You must be signed in to change notification settings - Fork 8
/
karma.conf.js
96 lines (79 loc) · 3.21 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Helpers
const helpers = require("./scripts/helpers");
const ciInfo = require("ci-info");
const isCI = process.argv.indexOf("--watch=false") > -1 || ciInfo.isCI;
const ngxFormErrorsSpecificConfiguration = {
// base path that will be used to resolve all patterns (e.g. files, exclude)
basePath: "",
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["jasmine", "@angular-devkit/build-angular"],
// list of files to exclude
exclude: [
helpers.root("src/index.html") // not needed for unit testing
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
plugins: [
// Default karma plugins configuration: require("karma-*")
"karma-*",
require("@angular-devkit/build-angular/plugins/karma")
],
// test results reporter to use
// possible values: "dots", "progress", "spec", "junit", "mocha", "coverage" (others if you import reporters)
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
// https://www.npmjs.com/package/karma-junit-reporter
// https://www.npmjs.com/package/karma-spec-reporter
reporters: isCI ? ["mocha", "progress"] : ["mocha", "progress", "kjhtml", "coverage"],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// see: http://karma-runner.github.io/2.0/config/configuration-file.html
// possible values:
// "OFF" = config.LOG_DISABLE
// "ERROR" = config.LOG_ERROR
// "WARN" = config.LOG_WARN
// "INFO" = config.LOG_INFO
// "DEBUG" = config.LOG_DEBUG
// raw value defined in node_modules/karma/lib/constants.js
logLevel: "WARN",
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: isCI ? ["ChromeHeadlessNoSandbox"] : ["Chrome"],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: isCI,
// If true, tests restart automatically if a file is changed
restartOnFileChange: !isCI,
// Timeout settings
browserNoActivityTimeout: 30000,
browserDisconnectTolerance: 1,
browserDisconnectTimeout: 30000,
// Configuration for coverage-istanbul reporter
coverageReporter: {
// base output directory. If you include %browser% in the path it will be replaced with the karma browser name
dir: helpers.root("reports/coverage"),
subdir: ".",
// https://github.com/istanbuljs/istanbuljs/tree/73c25ce79f91010d1ff073aa6ff3fd01114f90db/packages/istanbul-reports/lib
reporters: [{ type: "html" }, { type: "lcovonly" }, { type: "text-summary" }, { type: "clover" }, { type: "json" }]
},
// Custom launcher configuration for ChromeHeadless (with Puppeteer)
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
// necessary for travis: https://github.com/puppeteer/puppeteer/blob/v7.1.0/docs/troubleshooting.md#setting-up-chrome-linux-sandbox
// as it runs in a container-based environment
flags: ["--no-sandbox", "--disable-setuid-sandbox"]
}
}
};
module.exports = {
default: function (config) {
return config.set(ngxFormErrorsSpecificConfiguration);
}
};