Skip to content

Commit bad52ee

Browse files
committed
some improvements
1 parent dac27d5 commit bad52ee

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/workers.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,19 @@ const createWorkerObjects = (testGroups, config, testRoot, options, selectedRuns
9797

9898
const currentOutputFolder = config.output;
9999
const currentMochawesomeReportDir = config.mocha.reporterOptions?.mochawesome.options.reportDir;
100-
const currentMochaJunitReporterFile = config.mocha.reporterOptions["mocha-junit-reporter"].options.mochaFile;
100+
const currentMochaJunitReporterFile = config.mocha.reporterOptions['mocha-junit-reporter'].options.mochaFile;
101101

102102
collection.createRuns(selectedRuns, config).forEach((worker) => {
103+
const separator = path.sep;
103104
const _config = { ...config };
104-
const workerName = worker.name.replace(":", "_");
105-
_config.output = `${currentOutputFolder}/${workerName}`;
105+
let workerName = worker.name.replace(':', '_');
106+
_config.output = `${currentOutputFolder}${separator}${workerName}`;
106107
if (config.mocha && config.mocha.reporterOptions) {
107-
_config.mocha.reporterOptions.mochawesome.options.reportDir = `${currentMochawesomeReportDir}/${workerName}`;
108-
109-
let _tempArray = currentMochaJunitReporterFile.split("/");
110-
111-
_tempArray = _tempArray.splice(_tempArray.length - 2, 0, workerName);
112-
113-
_config.mocha.reporterOptions?["mocha-junit-reporter"].options.mochaFile = _tempArray.join("/");
108+
_config.mocha.reporterOptions.mochawesome.options.reportDir = `${currentMochawesomeReportDir}${separator}${workerName}`;
114109

110+
let _tempArray = currentMochaJunitReporterFile.split(separator);
111+
_tempArray = _tempArray.splice(_tempArray.length - 2, 0, workerName);
112+
_config.mocha.reporterOptions['mocha-junit-reporter'].options.mochaFile = _tempArray.join(separator);
115113
}
116114
workerName = worker.getOriginalName() || worker.getName();
117115
const workerConfig = worker.getConfig();

0 commit comments

Comments
 (0)