Commit f09ecb3
Kai Liu
test(slack/api): preserve real exports through mock.module stub
The previous mock.module factory only returned getApp + getSlackBotToken,
so when later test files in the same Bun process imported other exports
from packages/ims/slack/client (e.g. sendChannelMessage in
packages/core/tasks/scheduler.ts and packages/core/test/web-routes.test.ts),
Bun resolved them against the stub and threw:
SyntaxError: Export named 'sendChannelMessage' not found in module
'/home/runner/work/ode/ode/packages/ims/slack/client.ts'
Locally test ordering hid this; CI's alphabetic ordering surfaced it as
2 failed tests / 2 unhandled errors in fast-checks.
Fix: load the real ./client first and spread its exports into the stub
before overriding getApp + getSlackBotToken. Downstream importers in the
same process now still see every real export.1 parent 823ed9d commit f09ecb3
1 file changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
7 | 14 | | |
8 | 15 | | |
9 | 16 | | |
| 17 | + | |
| 18 | + | |
10 | 19 | | |
| 20 | + | |
11 | 21 | | |
12 | 22 | | |
13 | 23 | | |
| |||
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
25 | | - | |
26 | | - | |
| 35 | + | |
| 36 | + | |
27 | 37 | | |
28 | 38 | | |
29 | 39 | | |
| |||
0 commit comments