Skip to content

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

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

test: isolate fixture state by copying per getFixture() call#26
aminevg wants to merge 1 commit into
amine/bump-depsfrom
amine/isolate-test-fixtures

Conversation

@aminevg
Copy link
Copy Markdown
Contributor

@aminevg aminevg commented May 24, 2026

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
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

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).
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