perf(test): stabilize e2e harness and reduce flaky gateway coverage

This commit is contained in:
Peter Steinberger
2026-02-13 17:31:58 +00:00
parent 2ab7715d16
commit fdfc34fa1f
25 changed files with 427 additions and 940 deletions

View File

@@ -547,9 +547,14 @@ describe("applyAuthChoice", () => {
}),
};
const previousTty = process.stdin.isTTY;
const stdin = process.stdin as unknown as { isTTY?: boolean };
stdin.isTTY = true;
const stdin = process.stdin as NodeJS.ReadStream & { isTTY?: boolean };
const hadOwnIsTTY = Object.prototype.hasOwnProperty.call(stdin, "isTTY");
const previousIsTTYDescriptor = Object.getOwnPropertyDescriptor(stdin, "isTTY");
Object.defineProperty(stdin, "isTTY", {
configurable: true,
enumerable: true,
get: () => true,
});
try {
const result = await applyAuthChoice({
@@ -562,7 +567,11 @@ describe("applyAuthChoice", () => {
expect(result.config.agents?.defaults?.model?.primary).toBe("github-copilot/gpt-4o");
} finally {
stdin.isTTY = previousTty;
if (previousIsTTYDescriptor) {
Object.defineProperty(stdin, "isTTY", previousIsTTYDescriptor);
} else if (!hadOwnIsTTY) {
delete stdin.isTTY;
}
}
});