forked from vmware-archive/clarity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
160 lines (153 loc) · 4.51 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
* Copyright (c) 2016-2019 VMware, Inc. All Rights Reserved.
* This software is released under MIT license.
* The full license information can be found in LICENSE in the root directory of this project.
*/
// const browsers = {
// chrome_latest_win_10: {
// base: 'SauceLabs',
// browserName: 'chrome',
// version: 'latest',
// platform: 'Windows 10',
// },
// firefox_latest_win_10: {
// base: 'SauceLabs',
// browserName: 'firefox',
// version: 'latest',
// platform: 'Windows 10',
// },
// safari_latest_osx_11: {
// base: 'SauceLabs',
// browserName: 'safari',
// version: 'latest',
// platform: 'macOS 10.13',
// },
// ie_11_win_8_1: {
// base: 'SauceLabs',
// browserName: 'internet explorer',
// version: 'latest',
// platform: 'Windows 8.1',
// },
// edge_latest_win_10: {
// base: 'SauceLabs',
// browserName: 'MicrosoftEdge',
// version: 'latest',
// platform: 'Windows 10',
// },
// };
module.exports = function(karma) {
'use strict';
const config = {
autoWatch: true,
basePath: '',
frameworks: ['jasmine', 'jasmine-matchers', '@angular-devkit/build-angular'],
plugins: [
// Frameworks
require('karma-jasmine'),
require('karma-jasmine-matchers'),
require('@angular-devkit/build-angular/plugins/karma'),
// Reporters
require('karma-jasmine-html-reporter'),
require('karma-htmlfile-reporter'),
require('karma-coverage-istanbul-reporter'),
require('karma-mocha-reporter'),
require('karma-notify-reporter'),
// Launchers
require('karma-chrome-launcher'),
require('karma-edge-launcher'),
require('karma-ie-launcher'),
require('karma-firefox-launcher'),
require('karma-safari-launcher'),
require('karma-sauce-launcher'),
],
files: [
// Custom Elements
{
pattern: './node_modules/@webcomponents/custom-elements/custom-elements.min.js',
included: true,
watched: false,
},
// Clarity UI
{
pattern: './src/clr-angular/main.scss',
included: false,
watched: true,
},
// Entry point to all our spec files
{ pattern: './tests/tests.entry.ts', watched: false },
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
jasmine: {
random: false,
},
},
reporters: ['mocha', 'coverage-istanbul', 'html', 'notify'],
htmlReporter: {
outputFile: './reports/unit/index.html',
useLegacyStyle: true,
useCompactStyle: true,
},
coverageIstanbulReporter: {
dir: './reports/coverage/',
fixWebpackSourcePaths: true,
reports: ['html', 'lcovonly', 'cobertura'],
thresholds: {
statements: 90,
lines: 90,
branches: 80, // goal to increase this to 90%
functions: 90,
},
},
browsers: [
// ChromeHeadless is the default, but you can toggle this list in dev. Always reset back to just ChromeHeadless.
'ChromeHeadless',
// "FirefoxHeadless",
// "Safari",
// "Edge",
// "IE",
],
browserNoActivityTimeout: 100000,
port: 9090,
runnerPort: 9191,
colors: true,
logLevel: karma.LOG_INFO,
singleRun: process.env.TRAVIS ? true : false,
concurrency: Infinity,
captureTimeout: 120000,
customLaunchers: {
ChromeHeadless: {
base: 'Chrome',
flags: ['--headless', '--disable-gpu', '--remote-debugging-port=9222'],
},
},
mochaReporter: {
ignoreSkipped: true,
},
};
// @TODO Consider moving from SL to BrowserStack, or give up on this. SL fails so often we can't rely on it.
// We'll use saucelabs for testing if and only if the access key is set in ENV, and CI flag is set.
// We'll modify the config as necessary.
// if (process.env.SAUCE_ACCESS_KEY && process.env.TRAVIS === 'true') {
// config.reporters.push('saucelabs');
// config.browsers = [
// 'chrome_latest_win_10',
// 'firefox_latest_win_10',
// // "safari_latest_osx_11",
// // "ie_11_win_8_1",
// // "edge_latest_win_10",
// ];
// config.customLaunchers = browsers;
// config.sauceLabs = {
// testName: 'Unit Tests',
// startConnect: true,
// extendedDebugging: true,
// // If you need to debug, here are some options
// // connectOptions: {
// // verbose: true,
// // logfile: './sauceconnect.log'
// // }
// };
// }
karma.set(config);
};