Commit 8257b0e
committed
fix(test): work around bun module mock leakage in API.test.tsx
Other test files (ProjectContext.test.tsx, WorkspaceContext.test.tsx) mock
@/browser/contexts/API with a fake APIProvider. Due to bun's known issue
with module mock isolation (oven-sh/bun#12823),
these mocks leak between test files.
This caused API.test.tsx to get the mocked APIProvider instead of the real
one, resulting in MockWebSocket never being created because the mocked
APIProvider just returns children without calling connect().
Fix: Import the real module first, then re-mock @/browser/contexts/API
with the real exports. This ensures subsequent tests that import from
that path get our real implementation, not another test's mock.
Change-Id: Ie4552acdea69e1078b364e5b8f97e084bf1ec788
Signed-off-by: Thomas Kosiewski <tk@coder.com>1 parent 93d5a6c commit 8257b0e
1 file changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
76 | 88 | | |
77 | 89 | | |
78 | 90 | | |
| |||
0 commit comments