diff options
| author | Adam Malczewski <[email protected]> | 2026-10-24 18:48:54 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-10-24 18:48:54 +0900 |
| commit | 34526ff48985643bed532b102e8943fa69e77a79 (patch) | |
| tree | 4208ec0f5f1ef2cf1a9cd9710a442ce10a5f0c61 /scripts/text-file-environment.ts | |
| parent | daefad66bdf8dee132d701a3b43ce0d227dde241 (diff) | |
| parent | b666d77df8cf4da6ae40fb5637268926f02cc44d (diff) | |
| download | dispatch-web-34526ff48985643bed532b102e8943fa69e77a79.tar.gz dispatch-web-34526ff48985643bed532b102e8943fa69e77a79.zip | |
Merge branch 'feature/text-file-embeds' into dev
Diffstat (limited to 'scripts/text-file-environment.ts')
| -rw-r--r-- | scripts/text-file-environment.ts | 19 |
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; |
