Ultimate

X_TEST_REGISTRY_LEAK

Means

a test file left a process-global registry dirty

Typical cause

a declareTags() or registerTier() call with nothing to undo it, in a test body or in the file's own beforeAll. Boot calls are the file's to clean up, and a leaked one silently changes the next file's premise — assertKnownTags short-circuits while nothing is declared, so one leaking file switched tag validation on for the rest of the process and a different package's tests failed. The baseline is sampled at the end of module evaluation, not at the first beforeEach: a preload's beforeEach runs after the file's beforeAll, so sampling there counted a beforeAll leak as part of the baseline and reported nothing. The cause names every offending file and what each left behind, never the file that happened to be running when it surfaced

Fix

the fix names the file and ends in a command that reproduces it — in "<file>" add: import { isolateDeclaredTags } from '@ultimat3/cache'; const restoreTags = isolateDeclaredTags(); afterAll(restoreTags); — then re-run: bun test "<file>" — with const restoreTiers = isolateTiers(); afterAll(restoreTiers); for tiers, from the same import. Never a reset: resetTiers() drops what a neighbour registered, and this guard reports additions only, so the damage lands as a failure in an innocent file with nothing pointing back. Entity and job registries are not covered — declaring at module scope is the idiom there, so a test that assumes an empty one calls isolateEntityRegistry() from @ultimat3/testing/registry-isolation (its own entry point, so the general harness does not load the entity registry) instead

Listed under Testing

This page as markdown