blob: 6507be234ba0a262cf98407669a9327ec4b5d1c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
|