From cce87f7e601cac8efb4ba18f1119a69b7e7fb325 Mon Sep 17 00:00:00 2001 From: can1357 Date: Fri, 24 Jul 2026 01:21:19 +0200 Subject: [PATCH] test: replaced banned Promise executor with withResolvers in 4085 repro --- packages/ai/test/issue-4085-repro.test.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/ai/test/issue-4085-repro.test.ts b/packages/ai/test/issue-4085-repro.test.ts index b48ed61cc..66c198abb 100644 --- a/packages/ai/test/issue-4085-repro.test.ts +++ b/packages/ai/test/issue-4085-repro.test.ts @@ -1,4 +1,4 @@ -import { afterEach, describe, expect, it, spyOn } from "bun:test"; +import { describe, expect, it, spyOn } from "bun:test"; import * as AIError from "@oh-my-pi/pi-ai/error"; import { POLL_MAX_ATTEMPTS, pollOperation } from "@oh-my-pi/pi-ai/registry/oauth/google-gemini-cli"; import { oauthFetch } from "@oh-my-pi/pi-ai/registry/oauth/google-oauth-shared"; @@ -10,14 +10,10 @@ import { oauthFetch } from "@oh-my-pi/pi-ai/registry/oauth/google-oauth-shared"; * the caller's own signal/timeout. */ function stallingServer() { - return Bun.serve({ port: 0, idleTimeout: 0, fetch: () => new Promise(() => {}) }); + return Bun.serve({ port: 0, idleTimeout: 0, fetch: () => Promise.withResolvers().promise }); } describe("issue #4085 — Google OAuth provisioning honors cancel/timeout", () => { - afterEach(() => { - // spyOn handles are restored per-test to stay full-suite safe. - }); - it("oauthFetch surfaces an already-cancelled signal as LoginCancelledError", async () => { const ctrl = new AbortController(); ctrl.abort(new Error("user pressed ESC"));