Skip to content

fix: fix per-project sequence config#10659

Merged
sheremet-va merged 13 commits into
vitest-dev:mainfrom
hi-ogawa:fix/issue-9645
Jun 25, 2026
Merged

fix: fix per-project sequence config#10659
sheremet-va merged 13 commits into
vitest-dev:mainfrom
hi-ogawa:fix/issue-9645

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Description

The current intent of per-project sequence config appears to be Omit<SequenceOptions, 'sequencer' | 'seed'> i.e. sequence.sequencer and sequence.seed are root only. This intent is broken both in type ProjectConfig and runtime. This PR fixes both.

As one exception not covered by doc, sequence.shuffle.files is a root config concept, so it's clarified in doc and excluded from ProjectConfig type.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

hi-ogawa and others added 2 commits June 25, 2026 13:03
The `sequence` block was serialized to workers from the root config only,
so per-project `concurrent`, `hooks`, `setupFiles`, and (test-level)
`shuffle` were silently ignored. Serialize these from the project config.
`seed` stays root-only since it anchors cross-project file ordering.

Also fix the `ProjectConfig` type typo (`sequencer` -> `sequence`) so
`sequence.seed`/`sequence.sequencer` are correctly hidden on projects, and
narrow project `shuffle` to drop the root-only `files` option.

Fixes vitest-dev#9645

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
Replace the serialized-config assertion with a runtime e2e test that runs
two projects with different `sequence.concurrent` values and asserts the
fixtures (which self-assert `task.concurrent` and completion order) pass.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
@netlify

netlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 2b02bb7
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a3cc1f959d379000826a801
😎 Deploy Preview https://deploy-preview-10659--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

hi-ogawa and others added 2 commits June 25, 2026 13:20
Drop the helper and the per-project `sequencer` check (projects cannot set
`sequencer`); only test-level `shuffle` is per project.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
Per-project `sequence.shuffle` is now honored at runtime, but `sequence.seed`
is resolved from the root config only. If the root config doesn't shuffle, its
seed stays undefined, so a project that shuffles its tests would run unseeded
and non-reproducibly. Default the shared root seed once when any project
shuffles.

Also restore a serialized-config test asserting per-project `hooks`,
`setupFiles`, and `shuffle` while `seed` stays the shared root value, plus the
seed-is-defined-when-a-project-shuffles case.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
@hi-ogawa hi-ogawa changed the title fix: fix per-project sequence options fix: fix per-project sequence config Jun 25, 2026
hi-ogawa and others added 2 commits June 25, 2026 14:11
Resolve `sequence.seed` unconditionally in `resolveConfig`, consistent with
the sibling `groupOrder`/`hooks` defaults. This removes the need for the
post-resolution cross-project fixup: a shared root seed always exists, so
per-project `sequence.shuffle` is reproducible without special-casing whether
the root config itself shuffles.

`getSeed()` now always returns the seed (number) rather than null when nothing
shuffles; the seed is unused unless tests run at random.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
Fold the serialized-config assertion into configureVitest.test.ts (reusing its
createVitest helper) instead of a standalone file, and drop the shared-seed
test.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
if (resolved.sequence.sequencer === RandomSequencer || resolved.sequence.shuffle) {
resolved.sequence.seed ??= Date.now()
}
resolved.sequence.seed ??= Date.now()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I simplified this and getSeed since I wasn't sure if leaving seed undefined is intended from the context of:

If we want to keep getSeed returning null, we can keep revert this and seed fixup seed can happen later during resolveProjects, so let me know.

@hi-ogawa hi-ogawa Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Actually we can keep the semantics of getSeed while ensuring seed number at resolved config level. See changes in getSeed.

hi-ogawa and others added 7 commits June 25, 2026 14:33
Add a runInlineTests case (with a real config file, required for `extends`)
asserting a bare inline project does not inherit the root `sequence` (uses
defaults) while `extends: true` does, and that `seed` is shared from the root
either way.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
Move the per-project sequence serialization test out of configureVitest.test.ts
and the inheritance test out of sequence-shuffle.test.ts into a single
runInlineTests case under config/sequence.test.ts. One root config + three
projects covers project override, non-inheritance for bare inline projects,
inheritance via `extends: true`, and the shared root seed.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
runInlineTests serializes an object value to the config file, so pass the
config as a typed object instead of a template string. This type-checks the
`extends` usage and the narrowed project `sequence` shape.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
Keep `sequence.seed` resolved unconditionally at the root, but restore
`getSeed(): number | null` returning null unless files or tests run at random
(in the root config or any project). This keeps the documented "seed iff
random" semantics (vitest-dev#8592, vitest-dev#9576) while sharing one seed across projects. The
logger banner now reuses `getSeed()` instead of duplicating the check.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
Verify the seed banner prints when only a project (not the root config)
shuffles its tests, exercising getSeed's per-project randomization check.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
@hi-ogawa hi-ogawa marked this pull request as ready for review June 25, 2026 06:18
@sheremet-va sheremet-va merged commit 40cdc7f into vitest-dev:main Jun 25, 2026
16 of 18 checks passed
@hi-ogawa hi-ogawa deleted the fix/issue-9645 branch June 25, 2026 07:46
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.

Project sequence.concurrent not being applied

2 participants