Skip to content

test: fileParallelism: false — the option singleThread was pretending to be - #67

Open
unixwhisperer wants to merge 1 commit into
mainfrom
security-lead/vitest-file-parallelism
Open

unixwhisperer wants to merge 1 commit into
mainfrom
security-lead/vitest-file-parallelism

Conversation

@unixwhisperer

Copy link
Copy Markdown
Collaborator

You were right about the types, and it's worse than a form error.

grep over node_modules/vitest for poolOptions in any .d.ts in 4.1.11 returns nothing; fileParallelism is there as a top-level key. singleThread isn't in the types either — and vitest ignores unknown config keys silently, so singleThread: true has been sitting in vitest.config.js doing nothing. The suite has been running files in parallel this whole time, the opposite of what that line was asking for.

The run summary said so in plain sight: summed test time 1153.99s against a 117.27s wall clock.

It matters because isolate: false is set directly below it. Files sharing a worker share module state, and which files share a worker isn't deterministic. The suite was green — but green under a scheduling arrangement nobody chose and nobody can reproduce on purpose.

Measured, same tree, only this config line differing

wall summed tests setup
parallel (before) 117.27s 1153.99s 25.73s
serialised (after) 136.89s 133.92s 0.91s

Serialising costs about 20 seconds of wall clock, not the 10x the summed figure implies. The parallel run was mostly contending with itself — re-running setup in every worker and thrashing. Total test work drops 8.6x.

221/221 across 20 files before and after. Same file count, same test count, so the green run asserts exactly what it did before — no tests quietly dropped out of discovery.

One line of config, one comment block explaining why, no test touched.

🤖 Generated with Claude Code

… to be

`singleThread: true` has been sitting in vitest.config.js doing nothing. It is
not a vitest 4 option: it was `poolOptions.threads.singleThread` in v1, and
`poolOptions` itself is absent from 4.1.11's types — checked, `grep` over
node_modules/vitest for `poolOptions` in any .d.ts returns nothing, while
`fileParallelism` is there as a top-level key. Vitest ignores unknown config keys
silently, so the suite has been running files in PARALLEL the whole time, which
is the opposite of what that line was asking for.

The run summary showed it plainly: summed test time 1153.99s against a 117.27s
wall clock, i.e. ~10 workers.

It matters because `isolate: false` is set directly below, so files that share a
worker also share module state, and which files share a worker is not
deterministic. The suite was green, but green under a scheduling arrangement
nobody chose and nobody can reproduce on purpose.

MEASURED, same tree, only this config line differing:

  parallel (before)     wall 117.27s   tests 1153.99s   setup 25.73s
  serialised (after)    wall 136.89s   tests  133.92s   setup  0.91s

So the wall-clock cost of serialising is ~20 seconds, not the 10x the summed
figure suggests — the parallel run was mostly contending with itself, re-running
setup in every worker and thrashing. Total test work drops 8.6x.

221/221 across 20 files before and after. Discovery is untouched: same file
count, same test count, so the green run asserts exactly what it did before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
web Ready Ready Preview Sep 21, 2026 9:05am UTC

Request Review

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.

1 participant