perf(test): reduce setup overhead; isolate sharp-heavy suites

This commit is contained in:
Peter Steinberger
2026-02-14 03:29:55 +00:00
parent 2d4d32cb2d
commit 38a157ff23
2 changed files with 12 additions and 2 deletions

View File

@@ -163,11 +163,18 @@ const createDefaultRegistry = () =>
},
]);
// Creating a fresh registry before every single test was measurable overhead.
// The registry is treated as immutable by production code; tests that need a
// custom registry set it explicitly.
const DEFAULT_PLUGIN_REGISTRY = createDefaultRegistry();
beforeEach(() => {
setActivePluginRegistry(createDefaultRegistry());
setActivePluginRegistry(DEFAULT_PLUGIN_REGISTRY);
});
afterEach(() => {
// Guard against leaked fake timers across test files/workers.
vi.useRealTimers();
if (vi.isFakeTimers()) {
vi.useRealTimers();
}
});