summaryrefslogtreecommitdiffhomepage
path: root/scripts/text-file-environment.ts
diff options
context:
space:
mode:
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;