Skip to content

Commit f3ef59e

Browse files
author
Alex Plischke
authored
Allow users to add a single reporter without wrapping it in an array (#185)
* Allow users to add a single reporter without wrapping it in an array
1 parent e7d0e58 commit f3ef59e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/sauce.config.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ const overrides = {
4747
testIgnore: process.env.TEST_IGNORE,
4848
};
4949

50+
// Values that are arrays are merged at the very end (see arrMerger()), but primitives are not.
51+
// Allow the user to set a single reporter like so: `reporter: 'list'`.
52+
if (userConfig.reporter && !(userConfig.reporter instanceof Array)) {
53+
overrides.reporter.push([userConfig.reporter]);
54+
}
55+
5056
if (process.env.BROWSER_NAME !== 'chrome') {
5157
// chromium, firefox and webkit come pre-packaged with playwright.
5258
// So we can just pass those browser values to playwright and
@@ -63,12 +69,12 @@ if ('HTTP_PROXY' in process.env && process.env.HTTP_PROXY !== '') {
6369
server: process.env.HTTP_PROXY,
6470
};
6571

66-
overrides.use.contextOptions = { proxy, ignoreHTTPSErrors: true };
72+
overrides.use.contextOptions = {proxy, ignoreHTTPSErrors: true};
6773
// Need to set the browser launch option as well, it is a hard requirement when testing chromium + windows.
68-
overrides.use.launchOptions = { proxy, ignoreHTTPSErrors: true };
74+
overrides.use.launchOptions = {proxy, ignoreHTTPSErrors: true};
6975
}
7076

71-
function arrMerger (objValue, srcValue) {
77+
function arrMerger(objValue, srcValue) {
7278
if (_.isArray(objValue)) {
7379
return objValue.concat(srcValue);
7480
}

0 commit comments

Comments
 (0)