Skip to content

feat: parallel execution by workers on multiple browsers results with multiple output folders #3971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions lib/workers.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,31 @@ const createWorkerObjects = (testGroups, config, testRoot, options, selectedRuns
});
}
const workersToExecute = [];

const currentOutputFolder = config.output;
let currentMochawesomeReportDir;
let currentMochaJunitReporterFile;

if (config.mocha && config.mocha.reporterOptions) {
currentMochawesomeReportDir = config.mocha.reporterOptions?.mochawesome.options.reportDir;
currentMochaJunitReporterFile = config.mocha.reporterOptions['mocha-junit-reporter'].options.mochaFile;
}

collection.createRuns(selectedRuns, config).forEach((worker) => {
const workerName = worker.getOriginalName() || worker.getName();
const separator = path.sep;
const _config = { ...config };
let workerName = worker.name.replace(':', '_');
_config.output = `${currentOutputFolder}${separator}${workerName}`;
if (config.mocha && config.mocha.reporterOptions) {
_config.mocha.reporterOptions.mochawesome.options.reportDir = `${currentMochawesomeReportDir}${separator}${workerName}`;

const _tempArray = currentMochaJunitReporterFile.split(separator);
_tempArray.splice(_tempArray.findIndex(item => item.includes('.xml')), 0, workerName);
_config.mocha.reporterOptions['mocha-junit-reporter'].options.mochaFile = _tempArray.join(separator);
}
workerName = worker.getOriginalName() || worker.getName();
const workerConfig = worker.getConfig();
workersToExecute.push(getOverridenConfig(workerName, workerConfig, config));
workersToExecute.push(getOverridenConfig(workerName, workerConfig, _config));
});
const workers = [];
let index = 0;
Expand Down