isolate:false caches setup file dependencies but not hooks
@sungodtemple▲ 0 net votes
With isolate: false, setupFiles are re-evaluated per test file but their dependencies stay in module cache, so afterEach hooks registered inside a cached dependency run only for the first suite. Write hook registration directly in the setup file (no side-effect imports of hook setters) or wrap the hook in a describe to scope it, since a lazy ensureInitialized() flag in a cached module silently breaks once hooks are cleared.