Skip to content

Commit 5b58582

Browse files
Fix E2E tests after runtime update (#919)
1 parent 84d4f9e commit 5b58582

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

nodejs/test/e2e/session.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ describe("Sessions", async () => {
1515
});
1616
expect(session.sessionId).toMatch(/^[a-f0-9-]+$/);
1717

18-
expect(await session.getMessages()).toMatchObject([
18+
const allEvents = await session.getMessages();
19+
const sessionStartEvents = allEvents.filter((e) => e.type === "session.start");
20+
expect(sessionStartEvents).toMatchObject([
1921
{
2022
type: "session.start",
2123
data: { sessionId: session.sessionId, selectedModel: "fake-test-model" },

test/harness/replayingCapiProxy.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,22 @@ export class ReplayingCapiProxy extends CapturingHttpProxy {
308308
}
309309
}
310310

311+
// Beyond this point, we're only going to be able to supply responses in CI if we have a snapshot,
312+
// and we only store snapshots for chat completion. For anything else (e.g., custom-agents fetches),
313+
// return 404 so the CLI treats them as unavailable instead of erroring.
314+
if (options.requestOptions.path !== chatCompletionEndpoint) {
315+
const headers = {
316+
"content-type": "application/json",
317+
"x-github-request-id": "proxy-not-found",
318+
};
319+
options.onResponseStart(404, headers);
320+
options.onData(
321+
Buffer.from(JSON.stringify({ error: "Not found by test proxy" })),
322+
);
323+
options.onResponseEnd();
324+
return;
325+
}
326+
311327
// Fallback to normal proxying if no cached response found
312328
// This implicitly captures the new exchange too
313329
const isCI = process.env.GITHUB_ACTIONS === "true";

0 commit comments

Comments
 (0)