From b666d77df8cf4da6ae40fb5637268926f02cc44d Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sat, 24 Oct 2026 18:47:01 +0900 Subject: test: run frontend verification natively under Bun Make Bun the explicit Vitest runtime. Detect cyclic tool input before slow native pretty serialization, preserve shared references, and use native abort signals in the live jsdom probe. 2587 tests repeatedly green and2 real HTTP/UI tests pass; Bun-run typecheck, lint and production build pass without NODE_OPTIONS. --- scripts/text-file-environment.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/text-file-environment.ts (limited to 'scripts/text-file-environment.ts') diff --git a/scripts/text-file-environment.ts b/scripts/text-file-environment.ts new file mode 100644 index 0000000..6507be2 --- /dev/null +++ b/scripts/text-file-environment.ts @@ -0,0 +1,19 @@ +import type { Environment } from "vitest/environments"; +import { builtinEnvironments } from "vitest/environments"; + +/** Real runtime fetch and AbortSignal must belong to the same implementation. + * jsdom supplies DOM APIs but replaces these globals with an incompatible realm. + * Keep the runtime's pair for this opt-in real-network component probe only. + */ +export default { + name: "text-file-jsdom", + transformMode: "web", + async setup(global, options) { + const controller = global.AbortController; + const signal = global.AbortSignal; + const environment = await builtinEnvironments.jsdom.setup(global, options); + global.AbortController = controller; + global.AbortSignal = signal; + return environment; + }, +} satisfies Environment; -- cgit v1.2.3