forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowser-providers.js
29 lines (25 loc) · 1.09 KB
/
browser-providers.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
/*
* Browser Configuration for the different jobs in the legacy Karma tests.
*
* - `browserstack`: Launches the browser within BrowserStack
* - `saucelabs`: Launches the browser within Saucelabs
*/
const browserConfig = {
'iOS15': {unitTest: {target: 'saucelabs'}},
'Safari15': {unitTest: {target: 'browserstack'}},
};
/** Exports all available custom Karma browsers. */
exports.customLaunchers = require('./karma-browsers.json');
/** Exports a map of configured browsers, which should run in the given platform. */
exports.platformMap = {
'saucelabs': buildConfiguration('unitTest', 'saucelabs'),
'browserstack': buildConfiguration('unitTest', 'browserstack'),
};
/** Build a list of configuration (custom launcher names). */
function buildConfiguration(type, target) {
const targetBrowsers = Object.keys(browserConfig)
.map(browserName => [browserName, browserConfig[browserName][type]])
.filter(([, config]) => config.target === target)
.map(([browserName]) => browserName);
return targetBrowsers.map(browserName => `${target.toUpperCase()}_${browserName.toUpperCase()}`);
}