Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/fix-shuffle-tests-seed-logging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"vitest": patch
Copy link
Member

Choose a reason for hiding this comment

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

We don’t use changeset, this file can be deleted

---

fix: log seed when only `sequence.shuffle.tests` is enabled

Previously, the seed was only logged when `sequence.shuffle.files` was enabled (which uses RandomSequencer).
Now the seed is also logged when only `sequence.shuffle.tests` is enabled, since the seed is used for
shuffling tests within files even when file order is not randomized.

Fixes #9557
3 changes: 2 additions & 1 deletion packages/vitest/src/node/config/resolveConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ export function resolveConfig(
}
resolved.sequence.groupOrder ??= 0
resolved.sequence.hooks ??= 'stack'
if (resolved.sequence.sequencer === RandomSequencer) {
// Set seed if either files or tests are shuffled
if (resolved.sequence.sequencer === RandomSequencer || resolved.sequence.shuffle) {
resolved.sequence.seed ??= Date.now()
}

Expand Down
3 changes: 2 additions & 1 deletion packages/vitest/src/node/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ export class Logger {

this.log(withLabel(color, mode, `v${this.ctx.version} `) + c.gray(this.ctx.config.root))

if (this.ctx.config.sequence.sequencer === RandomSequencer) {
// Log seed if either files (RandomSequencer) or tests are shuffled
if (this.ctx.config.sequence.sequencer === RandomSequencer || this.ctx.config.sequence.shuffle) {
this.log(PAD + c.gray(`Running tests with seed "${this.ctx.config.sequence.seed}"`))
}

Expand Down