Skip to content

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

Closed

Description

@mirao

Summary

With a multiple config, run-workers N <run> sets each worker's output_dir to a sub-directory such as output/default_chromium1, but never creates it. Only the root output/ is created. Any test that writes into output_dir before a plugin happens to create the folder (e.g. the screenshot plugin on a failure) fails with ENOENT.

run-multiple with the same config works, because every child process goes through run, which calls createOutputDir() for its own output.

Reproduction

package.json:

{ "name": "repro", "type": "module", "private": true }

codecept.conf.js:

export const config = {
  tests: './*_test.js',
  output: './output',
  helpers: { FileSystem: {} },
  multiple: { default: { browsers: ['chromium', 'webkit'] } },
  name: 'repro',
}

write_test.js:

import path from 'path'

Feature('Write to output_dir')

Scenario('write a file into output_dir', ({ I }) => {
  I.writeToFile(path.join(path.relative('', global.output_dir), 'data.txt'), 'hello')
})
$ rm -rf output && npx codeceptjs run-workers 2 default
[Worker 01]   FAIL  | 0 passed, 1 failed
[Worker 02]   FAIL  | 0 passed, 1 failed
  ENOENT: no such file or directory, open '.../repro/output/default_chromium1/data.txt'
  ENOENT: no such file or directory, open '.../repro/output/default_webkit1/data.txt'

$ ls output
result.json

$ rm -rf output && npx codeceptjs run-multiple default
[2.default:webkit]   OK  | 1 passed
[1.default:chromium]   OK  | 1 passed

No browser is needed. The browsers entries only name the runs.

Expected

Each worker's output directory (output/default_chromium1, output/default_webkit1) exists before its tests start, the same as with run and run-multiple.

Cause

lib/command/run-workers.js and lib/workers.js (createOutputDir) create only config.output. createWorkerObjects() in lib/workers.js then sets _config.output = <output>/<workerName> and workerObj.runOutputDir, but nothing calls mkdirp on that path. A mkdirp.sync(workerObj.runOutputDir) there, or in the worker on startup, would fix it.

Environment

  • CodeceptJS 4.2.4, and also 3.7.9 (same result with a CommonJS version of the repro)
  • Node.js 24 (the same happens under Bun)
  • Linux

Created by AI agent (Claude Code)

Activity

  1. changed the title [-]4.x: run-workers with a multiple config doesn't create each worker's output directory (ENOENT when writing to output_dir)[/-] [+]run-workers with a multiple config doesn't create each worker's output directory (ENOENT when writing to output_dir)[/+] on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions