finos / finos/git-proxy

Unit tests fail on parallel execution on Vitest v4

Open
#1,565 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
249
Forks
176
Avg merge
3d 8h
Merged PRs (30d)
20

Description

When running unit tests in parallel, either locally or on the CI, tests often fail or are flaky:

Image

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.