Skip to content

fix(workers): create output directory of each run in run-workers - #5809

Merged
DenysKuchma merged 1 commit into
codeceptjs:4.xfrom
mirao:fix/run-workers-output-dir-5807
Nov 18, 2026
Merged

DenysKuchma merged 1 commit into
codeceptjs:4.xfrom
mirao:fix/run-workers-output-dir-5807

Conversation

@mirao

@mirao mirao commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #5807

Problem

With a multiple config, run-workers N <run> sets each worker's output to <output>/<run>_<browser>N, but it creates only the root output/ folder. A test that writes into output_dir before a plugin creates the folder fails with ENOENT. run-multiple doesn't have this problem, because each child process creates its own output folder through run.

Changes

  • lib/workers.js: createWorkerObjects() now calls mkdirp.sync() on each worker's runOutputDir right after computing it.
  • test/runner/run_workers_test.js:
    • New test, should create output directory of each run in multi-run. It uses a new sandbox config without plugins (codecept.workers-multiple-output.conf.js), so nothing else creates the folders. It fails without the fix.
    • The should create output folder with custom name test now removes thisIsCustomOutputFolderName/ after the check. It used to stay behind in test/data/sandbox as an untracked folder.

Tests

  • The repro from the issue now passes, and data.txt is written into both default_chromium1/ and default_webkit1/.
  • npx mocha test/runner/run_workers_test.js: 43 passing.
  • npx mocha test/unit/worker_test.js: 13 passing, 2 pending.

🤖 Generated with Claude Code

…eceptjs#5807)

With a `multiple` config, run-workers set each worker's output to
<output>/<run>_<browser>N but never created it, so tests writing into
output_dir failed with ENOENT unless a plugin created the folder first.

Also remove the folder left behind by the custom output folder name test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
exec(`${codecept_run_glob('codecept.workers-multiple-output.conf.js')} 2 dev`, (err, stdout) => {
expect(stdout).toMatch(/OK\s+\|\s+8 passed/)
expect(err).toEqual(null)
for (const run of ['dev_chromium1', 'dev_webkit1']) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curios why there is 1 appended to the folder name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kobenguyent
Have no idea. This is how run-workers names the folders.
run-multiple names them as dev_chromium_1, dev_webkit_2, dev_firefox_3 etc. (which makes sense to me)
Maybe some inconsistency.

@DenysKuchma

Copy link
Copy Markdown
Collaborator

Thanks! Merged

@DenysKuchma
DenysKuchma merged commit ba0be00 into codeceptjs:4.x Nov 18, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run-workers with a multiple config doesn't create each worker's output directory (ENOENT when writing to output_dir)

3 participants