forked from adobe/reactor-turbine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
188 lines (179 loc) · 4.84 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
'use strict';
var path = require('path');
var defaultBrowsers = ['Chrome'];
var reporters = ['dots'];
var startConnect = false;
var buildId;
if (process.env.CI) {
buildId =
'CI #' +
process.env.GITHUB_RUN_NUMBER +
' (' +
process.env.GITHUB_RUN_ID +
')';
defaultBrowsers = [
'SL_EDGE',
'SL_CHROME',
// 'SL_FIREFOX',
'SL_ANDROID',
'SL_SAFARI'
];
reporters.push('saucelabs');
} else {
startConnect = true;
}
if (process.env.SAUCE_USERNAME) {
reporters.push('saucelabs');
}
var argv = require('yargs')
.array('browsers')
.default('browsers', defaultBrowsers)
.default('singleRun', true)
.default('coverage', true).argv;
var rules = [];
if (argv.coverage) {
rules.push({
test: /\.js$/,
include: path.resolve('src'),
exclude: new RegExp('__tests__'),
loader: 'istanbul-instrumenter-loader'
});
rules.push({
test: /index.js$/,
include: path.resolve('coreModulePackages'),
exclude: new RegExp('node_modules'),
loader: 'istanbul-instrumenter-loader'
});
reporters.push('coverage');
}
module.exports = function (config) {
config.set({
autoWatch: true,
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
browserDisconnectTimeout: 180000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 300000,
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: argv.browsers,
captureTimeout: 180000,
colors: true,
// how many browser should be started simultaneous
concurrency: Infinity,
coverageReporter: {
reporters: [
{ type: 'html' },
{ type: 'lcovonly', subdir: '.', file: 'lcov.info' }
]
},
customLaunchers: {
SL_CHROME: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest'
},
SL_FIREFOX: {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest'
},
SL_SAFARI: {
base: 'SauceLabs',
browserName: 'safari',
// https://support.saucelabs.com/hc/en-us/community/posts/360016821133-Tests-on-Safari-11-started-failing-between-2018-07-19-and-2018-07-20
platform: 'macOS 10.13',
version: 'latest'
},
SL_EDGE: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
version: 'latest'
},
SL_IOS: {
base: 'SauceLabs',
deviceName: 'iPhone XS Simulator',
appiumVersion: '1.9.1',
browserName: 'Safari',
platformName: 'iOS',
platformVersion: '12.0'
},
SL_ANDROID: {
base: 'SauceLabs',
deviceName: 'Android GoogleAPI Emulator',
appiumVersion: '1.9.1',
browserName: 'Chrome',
platformName: 'Android',
platformVersion: '7.1'
}
},
exclude: ['**/*.test.js'],
// list of files / patterns to load in the browser
files: [
{
pattern: 'testIndex.js',
watched: false,
included: true,
served: true
},
// Used in load-script core module test.
{
pattern: 'coreModulePackages/loadScript/empty.js',
watched: false,
included: false,
served: true
}
],
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine', 'jasmine-matchers', 'webpack'],
hostname: '0.0.0.0',
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN
// || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'testIndex.js': ['webpack']
},
// web server port
port: 9876,
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: reporters,
sauceLabs: {
buildId: buildId,
testName: 'reactor-turbine Unit Test',
tunnelIdentifier: 'github-action-tunnel',
startConnect: startConnect,
retryLimit: 3,
recordVideo: false,
recordScreenshots: false,
// https://support.saucelabs.com/hc/en-us/articles/115010079868-Issues-with-Safari-and-Karma-Test-Runner
connectOptions: {
noSslBumpDomains: 'all'
}
},
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: argv.singleRun,
webpack: {
mode: 'development',
externals: {
window: 'window',
document: 'document'
},
resolve: {
extensions: ['.js']
},
module: {
rules: rules
}
},
webpackServer: {
debug: false,
progress: true,
quiet: false
}
});
};