-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathkarma.unit.conf.js
More file actions
210 lines (201 loc) · 6.01 KB
/
Copy pathkarma.unit.conf.js
File metadata and controls
210 lines (201 loc) · 6.01 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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/***************************************************************************************
* (c) 2025 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
****************************************************************************************/
'use strict';
const path = require('path');
const yargs = require('yargs');
const webpack = require('webpack');
const argv = yargs
.array('browsers')
.default('browsers', ['Chrome'])
.default('singleRun', true)
.default('coverage', true).argv;
const reporters = ['dots'];
let startConnect = false;
let buildId;
if (process.env.CI) {
buildId = `CI #${process.env.GITHUB_RUN_NUMBER} (${process.env.GITHUB_RUN_ID})`;
argv.browsers = ['SL_EDGE', 'SL_CHROME', 'SL_SAFARI'];
} else {
startConnect = true;
}
if (process.env.SAUCE_USERNAME) {
reporters.push('saucelabs');
}
var rules = [
{
test: /\.js$/,
include: path.resolve('src'),
exclude: new RegExp('__tests__'),
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/env', { targets: '> 0.25%, not dead' }]],
plugins: ['babel-plugin-istanbul']
}
}
},
{
test: /index.js$/,
include: path.resolve('coreModulePackages'),
exclude: new RegExp('node_modules'),
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/env', { targets: '> 0.25%, not dead' }]],
plugins: ['babel-plugin-istanbul']
}
}
}
];
if (argv.coverage) {
reporters.push('coverage-istanbul');
}
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,
coverageIstanbulReporter: {
reports: ['html', 'lcovonly', 'text-summary'],
'report-config': {
html: {
subdir: '.'
}
},
fixWebpackSourcePaths: true,
combineBrowserReports: true
},
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 11',
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: 'test.unitIndex.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: {
'test.unitIndex.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
},
plugins: [
new webpack.DefinePlugin({
REACTOR_KARMA_CI_UNIT_TEST_MODE: JSON.stringify(true)
})
]
},
webpackServer: {
debug: false,
progress: true,
quiet: false
}
});
};