Skip to content

test: isolate fixture state by copying per getFixture() call - #26

Closed
aminevg wants to merge 1 commit into
amine/bump-depsfrom
amine/isolate-test-fixtures
Closed

aminevg wants to merge 1 commit into
amine/bump-depsfrom
amine/isolate-test-fixtures

Conversation

@aminevg

@aminevg aminevg commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #25. Each getFixture() call now copies the source fixture to a unique fixtures/.tmp/<id>/ directory. The copy becomes fixtureRoot, so outDir, .astro, node_modules/.vite, and the CLI's default dist/ all land inside that unique dir — nothing is ever shared between tests.

clean() becomes a no-op, which removes the rm-during-vite-shutdown race entirely (the optimizer keeps writing async to node_modules/.vite after viteServer.close() returns). A globalSetup hook wipes fixtures/.tmp/ once before each test run.

Drops the workarounds introduced in #25:

  • maxRetries/retryDelay on the rm() calls in both fixture helpers
  • fileParallelism: false in the root vitest config

Suite drops from ~33s (serial) to ~20s (parallel) with parallelism re-enabled.

Test plan

  • pnpm build
  • pnpm run typecheck
  • pnpm run ci:biome
  • pnpm test — 5/5 consecutive runs green at full parallelism (verified locally)

@vercel

vercel Bot commented May 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
go-mighty Ready Ready Preview, Comment May 24, 2026 2:44pm

Each getFixture() call now copies the source fixture to a unique
fixtures/.tmp/<id>/ directory. The copy becomes the fixtureRoot, so
outDir, .astro, node_modules/.vite, and the CLI's default dist/ all
land inside that unique dir — nothing is ever shared between tests.

clean() becomes a no-op, which removes the rm-during-vite-shutdown
race entirely: the vite optimizer (esbuild) keeps writing async to
node_modules/.vite after viteServer.close() returns, so the previous
rm() in afterEach could race with it. With per-test directories there
is no longer any need to clean up between tests; a globalSetup hook
wipes fixtures/.tmp/ once before each test run instead.

Drops the workarounds from the previous PR:
- maxRetries/retryDelay on the rm() calls
- fileParallelism: false in the root vitest config

Test parallelism is re-enabled (~33s → ~20s for the full suite).
@aminevg

aminevg commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Closing along with #25, which it was stacked on. Fixture isolation is parked for now; the Astro 7 upgrade will revisit test stability on its own terms.

This branch was successfully deployed

1 active deployment
Preview — 00c20dcd Deployed May 24, 2026 by vercel[bot]
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.

1 participant