Vitest Storybook Browser Mode CI Disk Space Failures
Random `Failed to fetch dynamically imported module`, iframe disconnects, or browser connection closes can be real test bugs, but they can also be a disk-pressure symptom when Chromium, Vite, or the CI runner fills temporary storage mid-run.
CI evidence first
Capture runner disk, temp, Chromium, Vite, and artifact pressure before changing test config.
Use the read-only CI scan around the failing Storybook/Vitest step, then turn one real log into a team cleanup and sharding policy.
curl -fsSL https://site-xi-orcin-50.vercel.app/ci-macos-storage-scan.sh -o ci-macos-storage-scan.sh
Useful symptoms
- Different stories fail on different runs.
- The same suite passes locally but fails on GitHub Actions or Azure DevOps.
- CI logs include `No space left on device` or disk warnings near the failure.
- Firefox passes slowly while Chromium fails or hangs.
- Sharding reduces failures because each runner handles less browser state.
Capture evidence before changing config
Add this around the browser-mode test step so each failure has disk, temp, and deleted-open-file evidence.
echo "== before =="
df -h
du -sh /tmp "$RUNNER_TEMP" "$GITHUB_WORKSPACE" 2>/dev/null || true
pnpm test:sb
status=$?
echo "== after =="
df -h
du -sh /tmp "$RUNNER_TEMP" "$GITHUB_WORKSPACE" 2>/dev/null || true
echo "== deleted open Chromium temp files =="
for fd in /proc/[0-9]*/fd/*; do
target=$(readlink "$fd" 2>/dev/null) || continue
case "$target" in
*"(deleted)"*)
size=$(stat -Lc '%s' "$fd" 2>/dev/null || echo 0)
pid=${fd#/proc/}; pid=${pid%%/*}
cmd=$(tr '\0' ' ' < "/proc/$pid/cmdline" 2>/dev/null)
printf '%12s pid=%-7s %s -> %s\n' "$size" "$pid" "$cmd" "$target"
;;
esac
done | grep -Ei 'chrome|chromium|playwright|vite|vitest' | sort -nr | head -80 || true
exit "$status"
Separate three failure classes
- Vite dependency optimization reload: look for `optimized dependencies changed. reloading` and add the named packages to `optimizeDeps.include`.
- Chromium temp pressure: look for many deleted-open `/tmp/.org.chromium.*` files and test Playwright launch flags, sharding, or lower browser concurrency.
- Runner storage exhaustion: check if workspace, artifacts, pnpm cache, Playwright browsers, or generated reports consume the limited runner disk.
Safer fixes to try first
- Cache Vite optimized dependencies or explicitly include packages that optimize mid-run.
- Shard large Storybook suites before deleting cache folders blindly.
- Keep a disk snapshot in CI logs so future failures are measurable.
- Review Playwright/Chromium temp behavior before switching all tests to Firefox only.
Turn this into a team CI storage policy
The $99 Team Storage Pilot reviews one failing CI log or representative runner scan and returns a safe cleanup/sharding policy for Storybook, Vitest, Playwright, Vite caches, and runner artifacts.