summaryrefslogtreecommitdiffhomepage
path: root/scripts/text-file-environment.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-10-24 18:47:01 +0900
committerAdam Malczewski <[email protected]>2026-10-24 18:47:01 +0900
commitb666d77df8cf4da6ae40fb5637268926f02cc44d (patch)
tree4208ec0f5f1ef2cf1a9cd9710a442ce10a5f0c61 /scripts/text-file-environment.ts
parent48cdc3d19a319981a8a4128be98db3c283f81790 (diff)
downloaddispatch-web-b666d77df8cf4da6ae40fb5637268926f02cc44d.tar.gz
dispatch-web-b666d77df8cf4da6ae40fb5637268926f02cc44d.zip
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.
Diffstat (limited to 'scripts/text-file-environment.ts')
-rw-r--r--scripts/text-file-environment.ts19
1 files changed, 19 insertions, 0 deletions
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;