fix(run-multiple): restore plugin loading and per-child reportDir (#5577)#5578
Merged
Merged
Conversation
…deceptjs#5577) Two regressions introduced during the 3.x → 4.x ESM migration: ## Bug 1 – plugins with runInWorker:false silently skipped in child processes lib/container.js used options.child to detect "running inside a worker thread" and skipped plugins whose runInWorker is false (testomatio defaults to false). But run-multiple also sets --child on every forked child process, so those plugins were incorrectly skipped there too. Fix: replace options.child with !isMainThread (worker_threads). A run-multiple child is a freshly-forked OS process whose isMainThread is true, so the gate no longer fires. An actual run-workers worker thread has isMainThread === false, so the gate still fires as intended. | Context | options.child | isMainThread | before (skipped?) | after | |---------------------------|---------------|--------------|-------------------|--------| | run-workers worker thread | truthy (idx) | false | skipped ✓ | skipped ✓ | | run-multiple child proc | truthy (str) | true | skipped ✗ (bug) | loads ✓ | | normal run / parent proc | falsy | true | loads ✓ | loads ✓ | ## Bug 2 – all children write to the same reportDir, last one wins 3.x run-multiple.js replaced three per-child directory keys before forking: output, reportDir, mochaFile The 4.x port dropped the reportDir line, so every child kept the shared reportDir value from the config (e.g. "output/report") and overwrote each other's HTML file. Fix: restore the missing replaceValueDeep('reportDir', ...) call so each child receives its own directory, matching 3.x behaviour. Regression test added: verifies that a plugin with runInWorker:false is initialised once per child and that each child receives a distinct reportDir. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DavertMik
approved these changes
May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5577
Two regressions introduced during the 3.x → 4.x ESM migration caused the testomatio HTML reporter (and any plugin with
runInWorker: false) to produce no output when usingrun-multiple.Bug 1 – plugins with
runInWorker:falsesilently skipped in child processesFile:
lib/container.jsoptions.childwas used to detect "running inside a worker thread" and skipped plugins whoserunInWorkerisfalse(testomatiodefaults tofalse). Butrun-multiplealso sets--childon every forked child process, so those plugins were silently skipped there too — no error, no report.Fix: replace
options.childwith!isMainThread(from Node'sworker_threads). Arun-multiplechild is a freshly-forked OS process whoseisMainThreadistrue, so the gate no longer fires. An actualrun-workersworker thread hasisMainThread === false, so the gate still fires as intended.options.childisMainThreadrun-workersworker threadfalserun-multiplechild processtruerun/ parent processtrueBug 2 – all children write to the same
reportDir, last one winsFile:
lib/command/run-multiple.js3.x
run-multiple.jsreplaced three per-child directory keys before forking each child:The 4.x port dropped the
reportDirline, so every child kept the same sharedreportDirvalue from the config (e.g.output/report) and each child's run overwrote the previous one's HTML file.Fix: restore the missing
replaceValueDeep('reportDir', ...)call so each child receives its own directory — matching 3.x behaviour.Result
Before:
After:
Tests
A regression test is added to
test/runner/run_multiple_test.jsbacked by a minimal fixture plugin and config. It verifies both bugs together:runInWorker: falseis initialised once per child (not zero times).reportDir(not the same shared path).The test fails against the unfixed code and passes with the fix applied.
🤖 Generated with Claude Code