Commit 05e7af4
committed
fix(test): inject AbortSignal/TextEncoder into the miner-extension-live-fetch vm sandbox
node:vm's createContext() is a fresh, isolated realm with none of the
outer process's globals. background.js's live-fetch path bounds its
fetch with AbortSignal.timeout(...) (#4c0b19f4) and measures the real
serialized byte size via TextEncoder for the quota guard (#7062), but
the test harness never injected either global into the sandbox --
every call on the success path threw "<Global> is not defined",
caught by the function's own try/catch and silently misreported as a
typed failure result instead of a real one.
Confirmed this isn't CI flakiness: reproduced deterministically outside
CI, on every run, for any candidates payload that reaches the success
path (all 4 of the 7 originally-failing tests exercise that path; the
other 3 return early on a non-2xx/malformed/thrown-fetch branch before
ever touching either global).1 parent 0a2484f commit 05e7af4
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
| |||
0 commit comments