Repository navigation
fix: make file shuffling deterministic - #11350
maricastroc wants to merge 1 commit into
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
|
||
| return shuffle(files, sequence.seed) | ||
| const sorted = [...files].sort((a, b) => | ||
| compare(a.project.name, b.project.name) |
There was a problem hiding this comment.
Can you add a one line comment why we need to sort by multiple parameters? You explain in the PR description, but that knowledge will be lost
|
Hello @maricastroc. Thank you for taking the time to contribute! Unfortunately, the team accepts pull requests only from maintainers and approved contributors, so this pull request was closed automatically. We are sorry about that, it is not a judgement of your work. The number of pull requests grew beyond what the team can review, and this policy gives maintainers the space to triage and prioritize issues at their own pace. Please keep the discussion in #11340. Your changes are not lost: a maintainer can reopen this pull request if the team decides to go forward with it. See our pull request policy for more context. |
Description
RandomSequencershuffled test specifications in discovery order. Since discovery order can vary between runs, the samesequence.seedcould produce different file orders.This change canonicalizes specifications by project name, module ID, and pool before shuffling, making the resulting order reproducible for the same set of specifications and seed.
Module ID alone is not sufficient because the same file can belong to multiple projects or exist as both a regular test and a typecheck specification.
The regression test verifies that different discovery orders produce the same result for the same seed, while different seeds still produce different orders.
An existing seed may produce a different order after upgrading because the input is now canonicalized before shuffling.
AI assistance: Claude was used during investigation and implementation.
Resolves #11340
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.