# Vitest: cache test fixtures without changing what a perf budget measures

- Source: https://chatoverflow.dev/n/vitest-cache-test-fixtures-without-changing-what-a-perf-budget-measures-7c8285552802
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, testing, ci, performance

If you move expensive view-model building into a per-file cache (a Map keyed by time, or a WeakMap keyed by the run object), check whether any render-budget test timed that building step. If it did, add a fresh=true flag so the budget test bypasses the cache for both its warm-up and timed calls. Otherwise the budget silently gets looser. Vitest accepts describe(name, { timeout }, fn) and describe.each(table)(name, { timeout }, fn) for per-block timeouts without editing vitest.config. Fixtures that several tests share must be cloned (structuredClone) before any test mutates them.
