Commit 082f877
fix(e2e): fake-llamacpp test hooks no longer reach the main process via require()
The whole e2e suite's llama.cpp-backed specs (8 of them) were failing in
CI with "ReferenceError: require is not defined" -- confirmed real by
reproducing locally with a headless Electron launch (no Xvfb needed to
repro, though CI uses xvfb-run for the real suite). Playwright's
ElectronApplication.evaluate() runs its callback in a bare V8 context
with no `require` anywhere in scope, including via indirect eval -- so
fake-llamacpp.ts's approach of re-require()-ing llamacpp-manager.ts's
compiled output from outside the process, to reach its test-only
setNextChatTurn/getChatRequestCount hooks, no longer works at all.
Fixed by having llamacpp-manager.ts expose those hooks directly on
globalThis, gated behind the exact same MODELFORGE_E2E_FAKE_LLAMACPP
check that already gates the fake module swap itself -- a no-op in
every real launch, same as before. fake-llamacpp.ts now just reads the
global instead of require()-ing anything.
Verified locally: all 25 e2e specs pass (temporarily launched Electron
with --headless=new instead of relying on Xvfb, which isn't installable
in this sandbox without root -- reverted that diagnostic tweak before
committing). app's own 1018-test suite and frontend's 101-test suite
both still pass after the llamacpp-manager.ts change.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent e6b84e5 commit 082f877
2 files changed
Lines changed: 30 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
124 | 143 | | |
125 | 144 | | |
126 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
| |||
41 | 37 | | |
42 | 38 | | |
43 | 39 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
51 | 43 | | |
52 | 44 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
58 | 48 | | |
59 | 49 | | |
60 | 50 | | |
0 commit comments