Repository navigation
Description
bun test keeps a mock.module for the rest of the process, so a test file that mocks @/features/issues/workspace-provider.tsx and never restores it changes what the next file sees. That is what turned main red on the IssueCard suite this week (#398): one file replaced the whole module with a single export.
#398 fixed the one file that dropped exports. Fifteen more files still mock the provider without restoring it. They spread the real module, so they do not drop exports, but each leaks its useWorkspace fixture into whichever file loads next, and the failure shows up somewhere unrelated when directory order changes:
apps/web/tests/features/docs/doc-surface-access.test.tsxapps/web/tests/features/docs/doc-surface-return.test.tsxapps/web/tests/features/filters/filter-bar.test.tsxapps/web/tests/features/inbox/inbox-issue.test.tsxapps/web/tests/features/issues/board.test.tsxapps/web/tests/features/issues/copy-branch-name.test.tsxapps/web/tests/features/issues/issue-copy-actions.test.tsxapps/web/tests/features/issues/issue-deletion.test.tsxapps/web/tests/features/issues/issue-detail-delete.test.tsxapps/web/tests/features/issues/issue-properties.test.tsxapps/web/tests/features/issues/quick-create.test.tsxapps/web/tests/features/views/create-view-dialog.test.tsxapps/web/tests/features/views/saved-view-page.test.tsxapps/web/tests/features/views/unresolvable-scope.test.tsxapps/web/tests/features/views/views-page.test.tsx
In each: call restoreModulesAfterThisFile(['@/features/issues/workspace-provider.tsx']) from tests-support.ts before the mock, and if the factory calls the real hook, capture it first (const real = mod.useWorkspace) because bun rewires the live binding and mod.useWorkspace() inside the factory calls the mock itself. card-controls.test.tsx shows the pattern after #398.
Run bun run test in apps/web before and after; nothing should change except that file order stops mattering.
Activity