When running unit tests in parallel, either locally or on the CI, tests often fail or are flaky:
This can be reproduced by simply setting fileParallelism to true on vitest.config.ts, or by running npm run test-shuffle.
This was a known issue during/after our Mocha to Vitest migration (#1202, #1294), and we ultimately covered it up by running tests sequentially. The proper solution, requiring more effort, is to refactor our tests so that state is cleaned up correctly, and tests are truly atomic - in other words always pass even when executed randomly or in parallel.
Describe the solution you'd like
Refactoring any problematic unit and integration tests so that we can set fileParallelism: true on both vitest.config.ts and vitest.config.integration.ts.
Ideally, code coverage loss should be kept to a minimum, and if any tests are removed they should be replaced another one with similar intent and covered lines.
Additional context
Vitest migration PR: #1202
Related failing proxy tests post-migration: #1294
Vitest v4 upgrade which brought this problem to my attention #1564
When running unit tests in parallel, either locally or on the CI, tests often fail or are flaky:
This can be reproduced by simply setting
fileParallelismtotrueonvitest.config.ts, or by runningnpm run test-shuffle.This was a known issue during/after our Mocha to Vitest migration (#1202, #1294), and we ultimately covered it up by running tests sequentially. The proper solution, requiring more effort, is to refactor our tests so that state is cleaned up correctly, and tests are truly atomic - in other words always pass even when executed randomly or in parallel.
Describe the solution you'd like
Refactoring any problematic unit and integration tests so that we can set
fileParallelism: trueon bothvitest.config.tsandvitest.config.integration.ts.Ideally, code coverage loss should be kept to a minimum, and if any tests are removed they should be replaced another one with similar intent and covered lines.
Additional context
Vitest migration PR: #1202
Related failing proxy tests post-migration: #1294
Vitest v4 upgrade which brought this problem to my attention #1564