DashboardcliVitest TEST_TMP_DIR and SENTRY_CONFIG_D…

Vitest TEST_TMP_DIR and SENTRY_CONFIG_DIR isolation

Category: gotcha
Confidence: 1.00
ID: 01a08c08-73da-74ce-81d0-dae7be8a9244
Project ID: c760f4f9-42b0-4ce0-b36d-6b8c38d770b2
Cross-project: No
Recalled in other projects: 1
Source session: 0iRbOD1VHj1PKYbvU
Created: 2026-09-08 20:18:24
Updated: 2026-09-10 15:55:59

Cross-Project Recalls

ProjectHitsLast recalled
opencode 1 8d ago

Content

Trap: deleting a worker-wide TEST_TMP_DIR or SENTRY_CONFIG_DIR looks like clean isolation because each test uses child paths, but Vitest can reload setup within one pool while other files still use that root, causing SQLite disk I/O error and mkdtemp ENOENT. Fix: namespace roots by VITEST_POOL_ID; preload removes only its process child; helpers recreate the parent before mkdtemp; database tests use useTestConfigDir() and always restore the saved environment value, never delete it.

Move to: