vitest 0.21.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +61 -33
- package/dist/browser.d.ts +5 -5
- package/dist/browser.mjs +12 -10
- package/dist/{chunk-api-setup.7a6ba7fb.mjs → chunk-api-setup.5fc06d1d.mjs} +94 -91
- package/dist/chunk-constants.6196597b.mjs +284 -0
- package/dist/chunk-env-node.ceb43f1c.mjs +403 -0
- package/dist/{chunk-install-pkg.6c6dc0c2.mjs → chunk-install-pkg.e081fc1b.mjs} +2 -1
- package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
- package/dist/{chunk-integrations-globals.44a8f047.mjs → chunk-integrations-globals.ef598c23.mjs} +8 -9
- package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
- package/dist/chunk-mock-date.0d86eaa5.mjs +332 -0
- package/dist/chunk-node-git.6f289b0a.mjs +84 -0
- package/dist/{chunk-runtime-chain.98d42d89.mjs → chunk-runtime-chain.2af36ddf.mjs} +507 -172
- package/dist/{chunk-runtime-error.87a2b5a2.mjs → chunk-runtime-error.ed9b4f70.mjs} +208 -76
- package/dist/{chunk-runtime-hooks.453f8858.mjs → chunk-runtime-hooks.75ce0575.mjs} +18 -12
- package/dist/{chunk-runtime-mocker.23b62bfa.mjs → chunk-runtime-mocker.fc76f21d.mjs} +18 -11
- package/dist/{chunk-runtime-rpc.b50ab560.mjs → chunk-runtime-rpc.3fe371e9.mjs} +1 -2
- package/dist/{chunk-utils-source-map.94107ee8.mjs → chunk-utils-source-map.70ee97e1.mjs} +11 -4
- package/dist/{chunk-vite-node-client.fdd9592c.mjs → chunk-vite-node-client.74ebe3d5.mjs} +97 -31
- package/dist/{chunk-vite-node-debug.09afb76f.mjs → chunk-vite-node-debug.2d8a1dc3.mjs} +3 -3
- package/dist/{chunk-vite-node-externalize.27aee038.mjs → chunk-vite-node-externalize.41bf722e.mjs} +644 -222
- package/dist/{chunk-vite-node-utils.f34df9d3.mjs → chunk-vite-node-utils.68573626.mjs} +60 -42
- package/dist/cli-wrapper.mjs +128 -0
- package/dist/cli.mjs +29 -20
- package/dist/config.cjs +5 -2
- package/dist/config.d.ts +8 -4
- package/dist/config.mjs +4 -3
- package/dist/entry.mjs +20 -15
- package/dist/environments.d.ts +23 -0
- package/dist/environments.mjs +3 -0
- package/dist/{global-60f880c6.d.ts → global-ea084c9f.d.ts} +627 -178
- package/dist/{index-4a906fa4.d.ts → index-5f09f4d0.d.ts} +3 -50
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +7 -6
- package/dist/loader.mjs +3 -3
- package/dist/node.d.ts +5 -4
- package/dist/node.mjs +19 -16
- package/dist/suite.mjs +6 -5
- package/dist/vendor-index.0557b03a.mjs +147 -0
- package/dist/vendor-index.13e3bda3.mjs +61 -0
- package/dist/{chunk-node-git.c2be9c49.mjs → vendor-index.4aeeb598.mjs} +4 -72
- package/dist/{vendor-index.61438b77.mjs → vendor-index.731a22f2.mjs} +1 -61
- package/dist/worker.mjs +20 -18
- package/package.json +19 -16
- package/vitest.mjs +1 -1
- package/dist/chunk-constants.26dc9f85.mjs +0 -38
- package/dist/chunk-defaults.02abff90.mjs +0 -680
- package/dist/chunk-mock-date.bc81a3ac.mjs +0 -555
- package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
- package/dist/mocker-5e2a8e41.d.ts +0 -3
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import require$$0 from 'tty';
|
|
2
|
+
import url from 'url';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
var picocolors = {exports: {}};
|
|
6
|
+
|
|
7
|
+
let tty = require$$0;
|
|
8
|
+
|
|
9
|
+
let isColorSupported =
|
|
10
|
+
!("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
|
|
11
|
+
("FORCE_COLOR" in process.env ||
|
|
12
|
+
process.argv.includes("--color") ||
|
|
13
|
+
process.platform === "win32" ||
|
|
14
|
+
(tty.isatty(1) && process.env.TERM !== "dumb") ||
|
|
15
|
+
"CI" in process.env);
|
|
16
|
+
|
|
17
|
+
let formatter =
|
|
18
|
+
(open, close, replace = open) =>
|
|
19
|
+
input => {
|
|
20
|
+
let string = "" + input;
|
|
21
|
+
let index = string.indexOf(close, open.length);
|
|
22
|
+
return ~index
|
|
23
|
+
? open + replaceClose(string, close, replace, index) + close
|
|
24
|
+
: open + string + close
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
let replaceClose = (string, close, replace, index) => {
|
|
28
|
+
let start = string.substring(0, index) + replace;
|
|
29
|
+
let end = string.substring(index + close.length);
|
|
30
|
+
let nextIndex = end.indexOf(close);
|
|
31
|
+
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
let createColors = (enabled = isColorSupported) => ({
|
|
35
|
+
isColorSupported: enabled,
|
|
36
|
+
reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
|
|
37
|
+
bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
|
|
38
|
+
dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
|
|
39
|
+
italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
|
|
40
|
+
underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
|
|
41
|
+
inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
|
|
42
|
+
hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
|
|
43
|
+
strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
|
|
44
|
+
black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
|
|
45
|
+
red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
|
|
46
|
+
green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
|
|
47
|
+
yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
|
|
48
|
+
blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
|
|
49
|
+
magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
|
|
50
|
+
cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
|
|
51
|
+
white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
|
|
52
|
+
gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
|
|
53
|
+
bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
|
|
54
|
+
bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
|
|
55
|
+
bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
|
|
56
|
+
bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
|
|
57
|
+
bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
|
|
58
|
+
bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
|
|
59
|
+
bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
|
|
60
|
+
bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
picocolors.exports = createColors();
|
|
64
|
+
picocolors.exports.createColors = createColors;
|
|
65
|
+
|
|
66
|
+
function normalizeWindowsPath(input = "") {
|
|
67
|
+
if (!input.includes("\\")) {
|
|
68
|
+
return input;
|
|
69
|
+
}
|
|
70
|
+
return input.replace(/\\/g, "/");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const _UNC_REGEX = /^[/][/]/;
|
|
74
|
+
const _UNC_DRIVE_REGEX = /^[/][/]([.]{1,2}[/])?([a-zA-Z]):[/]/;
|
|
75
|
+
const _IS_ABSOLUTE_RE = /^\/|^\\|^[a-zA-Z]:[/\\]/;
|
|
76
|
+
const sep = "/";
|
|
77
|
+
const delimiter = ":";
|
|
78
|
+
const normalize = function(path2) {
|
|
79
|
+
if (path2.length === 0) {
|
|
80
|
+
return ".";
|
|
81
|
+
}
|
|
82
|
+
path2 = normalizeWindowsPath(path2);
|
|
83
|
+
const isUNCPath = path2.match(_UNC_REGEX);
|
|
84
|
+
const hasUNCDrive = isUNCPath && path2.match(_UNC_DRIVE_REGEX);
|
|
85
|
+
const isPathAbsolute = isAbsolute(path2);
|
|
86
|
+
const trailingSeparator = path2[path2.length - 1] === "/";
|
|
87
|
+
path2 = normalizeString(path2, !isPathAbsolute);
|
|
88
|
+
if (path2.length === 0) {
|
|
89
|
+
if (isPathAbsolute) {
|
|
90
|
+
return "/";
|
|
91
|
+
}
|
|
92
|
+
return trailingSeparator ? "./" : ".";
|
|
93
|
+
}
|
|
94
|
+
if (trailingSeparator) {
|
|
95
|
+
path2 += "/";
|
|
96
|
+
}
|
|
97
|
+
if (isUNCPath) {
|
|
98
|
+
if (hasUNCDrive) {
|
|
99
|
+
return `//./${path2}`;
|
|
100
|
+
}
|
|
101
|
+
return `//${path2}`;
|
|
102
|
+
}
|
|
103
|
+
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
104
|
+
};
|
|
105
|
+
const join = function(...args) {
|
|
106
|
+
if (args.length === 0) {
|
|
107
|
+
return ".";
|
|
108
|
+
}
|
|
109
|
+
let joined;
|
|
110
|
+
for (let i = 0; i < args.length; ++i) {
|
|
111
|
+
const arg = args[i];
|
|
112
|
+
if (arg.length > 0) {
|
|
113
|
+
if (joined === void 0) {
|
|
114
|
+
joined = arg;
|
|
115
|
+
} else {
|
|
116
|
+
joined += `/${arg}`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (joined === void 0) {
|
|
121
|
+
return ".";
|
|
122
|
+
}
|
|
123
|
+
return normalize(joined);
|
|
124
|
+
};
|
|
125
|
+
const resolve = function(...args) {
|
|
126
|
+
args = args.map((arg) => normalizeWindowsPath(arg));
|
|
127
|
+
let resolvedPath = "";
|
|
128
|
+
let resolvedAbsolute = false;
|
|
129
|
+
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
130
|
+
const path2 = i >= 0 ? args[i] : process.cwd();
|
|
131
|
+
if (path2.length === 0) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
resolvedPath = `${path2}/${resolvedPath}`;
|
|
135
|
+
resolvedAbsolute = isAbsolute(path2);
|
|
136
|
+
}
|
|
137
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
138
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
139
|
+
return `/${resolvedPath}`;
|
|
140
|
+
}
|
|
141
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
142
|
+
};
|
|
143
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
144
|
+
let res = "";
|
|
145
|
+
let lastSegmentLength = 0;
|
|
146
|
+
let lastSlash = -1;
|
|
147
|
+
let dots = 0;
|
|
148
|
+
let char = null;
|
|
149
|
+
for (let i = 0; i <= path2.length; ++i) {
|
|
150
|
+
if (i < path2.length) {
|
|
151
|
+
char = path2[i];
|
|
152
|
+
} else if (char === "/") {
|
|
153
|
+
break;
|
|
154
|
+
} else {
|
|
155
|
+
char = "/";
|
|
156
|
+
}
|
|
157
|
+
if (char === "/") {
|
|
158
|
+
if (lastSlash === i - 1 || dots === 1) ; else if (dots === 2) {
|
|
159
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
160
|
+
if (res.length > 2) {
|
|
161
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
162
|
+
if (lastSlashIndex === -1) {
|
|
163
|
+
res = "";
|
|
164
|
+
lastSegmentLength = 0;
|
|
165
|
+
} else {
|
|
166
|
+
res = res.slice(0, lastSlashIndex);
|
|
167
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
168
|
+
}
|
|
169
|
+
lastSlash = i;
|
|
170
|
+
dots = 0;
|
|
171
|
+
continue;
|
|
172
|
+
} else if (res.length !== 0) {
|
|
173
|
+
res = "";
|
|
174
|
+
lastSegmentLength = 0;
|
|
175
|
+
lastSlash = i;
|
|
176
|
+
dots = 0;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (allowAboveRoot) {
|
|
181
|
+
res += res.length > 0 ? "/.." : "..";
|
|
182
|
+
lastSegmentLength = 2;
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
if (res.length > 0) {
|
|
186
|
+
res += `/${path2.slice(lastSlash + 1, i)}`;
|
|
187
|
+
} else {
|
|
188
|
+
res = path2.slice(lastSlash + 1, i);
|
|
189
|
+
}
|
|
190
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
191
|
+
}
|
|
192
|
+
lastSlash = i;
|
|
193
|
+
dots = 0;
|
|
194
|
+
} else if (char === "." && dots !== -1) {
|
|
195
|
+
++dots;
|
|
196
|
+
} else {
|
|
197
|
+
dots = -1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return res;
|
|
201
|
+
}
|
|
202
|
+
const isAbsolute = function(p) {
|
|
203
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
204
|
+
};
|
|
205
|
+
const toNamespacedPath = function(p) {
|
|
206
|
+
return normalizeWindowsPath(p);
|
|
207
|
+
};
|
|
208
|
+
const extname = function(p) {
|
|
209
|
+
return path.posix.extname(normalizeWindowsPath(p));
|
|
210
|
+
};
|
|
211
|
+
const relative = function(from, to) {
|
|
212
|
+
return path.posix.relative(normalizeWindowsPath(from), normalizeWindowsPath(to));
|
|
213
|
+
};
|
|
214
|
+
const dirname = function(p) {
|
|
215
|
+
return path.posix.dirname(normalizeWindowsPath(p));
|
|
216
|
+
};
|
|
217
|
+
const format = function(p) {
|
|
218
|
+
return normalizeWindowsPath(path.posix.format(p));
|
|
219
|
+
};
|
|
220
|
+
const basename = function(p, ext) {
|
|
221
|
+
return path.posix.basename(normalizeWindowsPath(p), ext);
|
|
222
|
+
};
|
|
223
|
+
const parse = function(p) {
|
|
224
|
+
return path.posix.parse(normalizeWindowsPath(p));
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const _path = /*#__PURE__*/Object.freeze({
|
|
228
|
+
__proto__: null,
|
|
229
|
+
sep: sep,
|
|
230
|
+
delimiter: delimiter,
|
|
231
|
+
normalize: normalize,
|
|
232
|
+
join: join,
|
|
233
|
+
resolve: resolve,
|
|
234
|
+
normalizeString: normalizeString,
|
|
235
|
+
isAbsolute: isAbsolute,
|
|
236
|
+
toNamespacedPath: toNamespacedPath,
|
|
237
|
+
extname: extname,
|
|
238
|
+
relative: relative,
|
|
239
|
+
dirname: dirname,
|
|
240
|
+
format: format,
|
|
241
|
+
basename: basename,
|
|
242
|
+
parse: parse
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
({
|
|
246
|
+
..._path
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
const rootDir = resolve(url.fileURLToPath(import.meta.url), "../../");
|
|
250
|
+
const distDir = resolve(url.fileURLToPath(import.meta.url), "../../dist");
|
|
251
|
+
const defaultPort = 51204;
|
|
252
|
+
const EXIT_CODE_RESTART = 43;
|
|
253
|
+
const API_PATH = "/__vitest_api__";
|
|
254
|
+
const configFiles = [
|
|
255
|
+
"vitest.config.ts",
|
|
256
|
+
"vitest.config.mts",
|
|
257
|
+
"vitest.config.cts",
|
|
258
|
+
"vitest.config.js",
|
|
259
|
+
"vitest.config.mjs",
|
|
260
|
+
"vitest.config.cjs",
|
|
261
|
+
"vite.config.ts",
|
|
262
|
+
"vite.config.mts",
|
|
263
|
+
"vite.config.cts",
|
|
264
|
+
"vite.config.js",
|
|
265
|
+
"vite.config.mjs",
|
|
266
|
+
"vite.config.cjs"
|
|
267
|
+
];
|
|
268
|
+
const globalApis = [
|
|
269
|
+
"suite",
|
|
270
|
+
"test",
|
|
271
|
+
"describe",
|
|
272
|
+
"it",
|
|
273
|
+
"chai",
|
|
274
|
+
"expect",
|
|
275
|
+
"assert",
|
|
276
|
+
"vitest",
|
|
277
|
+
"vi",
|
|
278
|
+
"beforeAll",
|
|
279
|
+
"afterAll",
|
|
280
|
+
"beforeEach",
|
|
281
|
+
"afterEach"
|
|
282
|
+
];
|
|
283
|
+
|
|
284
|
+
export { API_PATH as A, EXIT_CODE_RESTART as E, resolve as a, basename as b, distDir as c, dirname as d, rootDir as e, configFiles as f, defaultPort as g, extname as h, isAbsolute as i, join as j, globalApis as k, normalize as n, picocolors as p, relative as r, toNamespacedPath as t };
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { Console } from 'console';
|
|
2
|
+
import { importModule } from 'local-pkg';
|
|
3
|
+
|
|
4
|
+
var node = {
|
|
5
|
+
name: "node",
|
|
6
|
+
async setup(global) {
|
|
7
|
+
global.console.Console = Console;
|
|
8
|
+
return {
|
|
9
|
+
teardown(global2) {
|
|
10
|
+
delete global2.console.Console;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const LIVING_KEYS = [
|
|
17
|
+
"DOMException",
|
|
18
|
+
"URL",
|
|
19
|
+
"URLSearchParams",
|
|
20
|
+
"EventTarget",
|
|
21
|
+
"NamedNodeMap",
|
|
22
|
+
"Node",
|
|
23
|
+
"Attr",
|
|
24
|
+
"Element",
|
|
25
|
+
"DocumentFragment",
|
|
26
|
+
"DOMImplementation",
|
|
27
|
+
"Document",
|
|
28
|
+
"XMLDocument",
|
|
29
|
+
"CharacterData",
|
|
30
|
+
"Text",
|
|
31
|
+
"CDATASection",
|
|
32
|
+
"ProcessingInstruction",
|
|
33
|
+
"Comment",
|
|
34
|
+
"DocumentType",
|
|
35
|
+
"NodeList",
|
|
36
|
+
"HTMLCollection",
|
|
37
|
+
"HTMLOptionsCollection",
|
|
38
|
+
"DOMStringMap",
|
|
39
|
+
"DOMTokenList",
|
|
40
|
+
"StyleSheetList",
|
|
41
|
+
"HTMLElement",
|
|
42
|
+
"HTMLHeadElement",
|
|
43
|
+
"HTMLTitleElement",
|
|
44
|
+
"HTMLBaseElement",
|
|
45
|
+
"HTMLLinkElement",
|
|
46
|
+
"HTMLMetaElement",
|
|
47
|
+
"HTMLStyleElement",
|
|
48
|
+
"HTMLBodyElement",
|
|
49
|
+
"HTMLHeadingElement",
|
|
50
|
+
"HTMLParagraphElement",
|
|
51
|
+
"HTMLHRElement",
|
|
52
|
+
"HTMLPreElement",
|
|
53
|
+
"HTMLUListElement",
|
|
54
|
+
"HTMLOListElement",
|
|
55
|
+
"HTMLLIElement",
|
|
56
|
+
"HTMLMenuElement",
|
|
57
|
+
"HTMLDListElement",
|
|
58
|
+
"HTMLDivElement",
|
|
59
|
+
"HTMLAnchorElement",
|
|
60
|
+
"HTMLAreaElement",
|
|
61
|
+
"HTMLBRElement",
|
|
62
|
+
"HTMLButtonElement",
|
|
63
|
+
"HTMLCanvasElement",
|
|
64
|
+
"HTMLDataElement",
|
|
65
|
+
"HTMLDataListElement",
|
|
66
|
+
"HTMLDetailsElement",
|
|
67
|
+
"HTMLDialogElement",
|
|
68
|
+
"HTMLDirectoryElement",
|
|
69
|
+
"HTMLFieldSetElement",
|
|
70
|
+
"HTMLFontElement",
|
|
71
|
+
"HTMLFormElement",
|
|
72
|
+
"HTMLHtmlElement",
|
|
73
|
+
"HTMLImageElement",
|
|
74
|
+
"HTMLInputElement",
|
|
75
|
+
"HTMLLabelElement",
|
|
76
|
+
"HTMLLegendElement",
|
|
77
|
+
"HTMLMapElement",
|
|
78
|
+
"HTMLMarqueeElement",
|
|
79
|
+
"HTMLMediaElement",
|
|
80
|
+
"HTMLMeterElement",
|
|
81
|
+
"HTMLModElement",
|
|
82
|
+
"HTMLOptGroupElement",
|
|
83
|
+
"HTMLOptionElement",
|
|
84
|
+
"HTMLOutputElement",
|
|
85
|
+
"HTMLPictureElement",
|
|
86
|
+
"HTMLProgressElement",
|
|
87
|
+
"HTMLQuoteElement",
|
|
88
|
+
"HTMLScriptElement",
|
|
89
|
+
"HTMLSelectElement",
|
|
90
|
+
"HTMLSlotElement",
|
|
91
|
+
"HTMLSourceElement",
|
|
92
|
+
"HTMLSpanElement",
|
|
93
|
+
"HTMLTableCaptionElement",
|
|
94
|
+
"HTMLTableCellElement",
|
|
95
|
+
"HTMLTableColElement",
|
|
96
|
+
"HTMLTableElement",
|
|
97
|
+
"HTMLTimeElement",
|
|
98
|
+
"HTMLTableRowElement",
|
|
99
|
+
"HTMLTableSectionElement",
|
|
100
|
+
"HTMLTemplateElement",
|
|
101
|
+
"HTMLTextAreaElement",
|
|
102
|
+
"HTMLUnknownElement",
|
|
103
|
+
"HTMLFrameElement",
|
|
104
|
+
"HTMLFrameSetElement",
|
|
105
|
+
"HTMLIFrameElement",
|
|
106
|
+
"HTMLEmbedElement",
|
|
107
|
+
"HTMLObjectElement",
|
|
108
|
+
"HTMLParamElement",
|
|
109
|
+
"HTMLVideoElement",
|
|
110
|
+
"HTMLAudioElement",
|
|
111
|
+
"HTMLTrackElement",
|
|
112
|
+
"SVGElement",
|
|
113
|
+
"SVGGraphicsElement",
|
|
114
|
+
"SVGSVGElement",
|
|
115
|
+
"SVGTitleElement",
|
|
116
|
+
"SVGAnimatedString",
|
|
117
|
+
"SVGNumber",
|
|
118
|
+
"SVGStringList",
|
|
119
|
+
"Event",
|
|
120
|
+
"CloseEvent",
|
|
121
|
+
"CustomEvent",
|
|
122
|
+
"MessageEvent",
|
|
123
|
+
"ErrorEvent",
|
|
124
|
+
"HashChangeEvent",
|
|
125
|
+
"PopStateEvent",
|
|
126
|
+
"StorageEvent",
|
|
127
|
+
"ProgressEvent",
|
|
128
|
+
"PageTransitionEvent",
|
|
129
|
+
"UIEvent",
|
|
130
|
+
"FocusEvent",
|
|
131
|
+
"InputEvent",
|
|
132
|
+
"MouseEvent",
|
|
133
|
+
"KeyboardEvent",
|
|
134
|
+
"TouchEvent",
|
|
135
|
+
"CompositionEvent",
|
|
136
|
+
"WheelEvent",
|
|
137
|
+
"BarProp",
|
|
138
|
+
"External",
|
|
139
|
+
"Location",
|
|
140
|
+
"History",
|
|
141
|
+
"Screen",
|
|
142
|
+
"Performance",
|
|
143
|
+
"Navigator",
|
|
144
|
+
"PluginArray",
|
|
145
|
+
"MimeTypeArray",
|
|
146
|
+
"Plugin",
|
|
147
|
+
"MimeType",
|
|
148
|
+
"FileReader",
|
|
149
|
+
"Blob",
|
|
150
|
+
"File",
|
|
151
|
+
"FileList",
|
|
152
|
+
"ValidityState",
|
|
153
|
+
"DOMParser",
|
|
154
|
+
"XMLSerializer",
|
|
155
|
+
"FormData",
|
|
156
|
+
"XMLHttpRequestEventTarget",
|
|
157
|
+
"XMLHttpRequestUpload",
|
|
158
|
+
"XMLHttpRequest",
|
|
159
|
+
"WebSocket",
|
|
160
|
+
"NodeFilter",
|
|
161
|
+
"NodeIterator",
|
|
162
|
+
"TreeWalker",
|
|
163
|
+
"AbstractRange",
|
|
164
|
+
"Range",
|
|
165
|
+
"StaticRange",
|
|
166
|
+
"Selection",
|
|
167
|
+
"Storage",
|
|
168
|
+
"CustomElementRegistry",
|
|
169
|
+
"ShadowRoot",
|
|
170
|
+
"MutationObserver",
|
|
171
|
+
"MutationRecord",
|
|
172
|
+
"Headers",
|
|
173
|
+
"AbortController",
|
|
174
|
+
"AbortSignal",
|
|
175
|
+
"Image",
|
|
176
|
+
"Audio",
|
|
177
|
+
"Option"
|
|
178
|
+
];
|
|
179
|
+
const OTHER_KEYS = [
|
|
180
|
+
"addEventListener",
|
|
181
|
+
"alert",
|
|
182
|
+
"atob",
|
|
183
|
+
"blur",
|
|
184
|
+
"btoa",
|
|
185
|
+
"cancelAnimationFrame",
|
|
186
|
+
"close",
|
|
187
|
+
"confirm",
|
|
188
|
+
"createPopup",
|
|
189
|
+
"dispatchEvent",
|
|
190
|
+
"document",
|
|
191
|
+
"focus",
|
|
192
|
+
"frames",
|
|
193
|
+
"getComputedStyle",
|
|
194
|
+
"history",
|
|
195
|
+
"innerHeight",
|
|
196
|
+
"innerWidth",
|
|
197
|
+
"length",
|
|
198
|
+
"location",
|
|
199
|
+
"matchMedia",
|
|
200
|
+
"moveBy",
|
|
201
|
+
"moveTo",
|
|
202
|
+
"name",
|
|
203
|
+
"navigator",
|
|
204
|
+
"open",
|
|
205
|
+
"outerHeight",
|
|
206
|
+
"outerWidth",
|
|
207
|
+
"pageXOffset",
|
|
208
|
+
"pageYOffset",
|
|
209
|
+
"parent",
|
|
210
|
+
"postMessage",
|
|
211
|
+
"print",
|
|
212
|
+
"prompt",
|
|
213
|
+
"removeEventListener",
|
|
214
|
+
"requestAnimationFrame",
|
|
215
|
+
"resizeBy",
|
|
216
|
+
"resizeTo",
|
|
217
|
+
"screen",
|
|
218
|
+
"screenLeft",
|
|
219
|
+
"screenTop",
|
|
220
|
+
"screenX",
|
|
221
|
+
"screenY",
|
|
222
|
+
"scroll",
|
|
223
|
+
"scrollBy",
|
|
224
|
+
"scrollLeft",
|
|
225
|
+
"scrollTo",
|
|
226
|
+
"scrollTop",
|
|
227
|
+
"scrollX",
|
|
228
|
+
"scrollY",
|
|
229
|
+
"self",
|
|
230
|
+
"stop",
|
|
231
|
+
"top",
|
|
232
|
+
"Window",
|
|
233
|
+
"window"
|
|
234
|
+
];
|
|
235
|
+
const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
|
|
236
|
+
|
|
237
|
+
const allowRewrite = [
|
|
238
|
+
"Event",
|
|
239
|
+
"EventTarget",
|
|
240
|
+
"MessageEvent",
|
|
241
|
+
"ArrayBuffer"
|
|
242
|
+
];
|
|
243
|
+
const skipKeys = [
|
|
244
|
+
"window",
|
|
245
|
+
"self",
|
|
246
|
+
"top",
|
|
247
|
+
"parent"
|
|
248
|
+
];
|
|
249
|
+
function getWindowKeys(global, win) {
|
|
250
|
+
const keys = new Set(KEYS.concat(Object.getOwnPropertyNames(win)).filter((k) => {
|
|
251
|
+
if (skipKeys.includes(k))
|
|
252
|
+
return false;
|
|
253
|
+
if (k in global)
|
|
254
|
+
return allowRewrite.includes(k);
|
|
255
|
+
return true;
|
|
256
|
+
}));
|
|
257
|
+
return keys;
|
|
258
|
+
}
|
|
259
|
+
function isClassLikeName(name) {
|
|
260
|
+
return name[0] === name[0].toUpperCase();
|
|
261
|
+
}
|
|
262
|
+
function populateGlobal(global, win, options = {}) {
|
|
263
|
+
const { bindFunctions = false } = options;
|
|
264
|
+
const keys = getWindowKeys(global, win);
|
|
265
|
+
const originals = new Map(
|
|
266
|
+
allowRewrite.filter((key) => key in global).map((key) => [key, global[key]])
|
|
267
|
+
);
|
|
268
|
+
const overrideObject = /* @__PURE__ */ new Map();
|
|
269
|
+
for (const key of keys) {
|
|
270
|
+
const boundFunction = bindFunctions && typeof win[key] === "function" && !isClassLikeName(key) && win[key].bind(win);
|
|
271
|
+
Object.defineProperty(global, key, {
|
|
272
|
+
get() {
|
|
273
|
+
if (overrideObject.has(key))
|
|
274
|
+
return overrideObject.get(key);
|
|
275
|
+
if (boundFunction)
|
|
276
|
+
return boundFunction;
|
|
277
|
+
return win[key];
|
|
278
|
+
},
|
|
279
|
+
set(v) {
|
|
280
|
+
overrideObject.set(key, v);
|
|
281
|
+
},
|
|
282
|
+
configurable: true
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
global.window = global;
|
|
286
|
+
global.self = global;
|
|
287
|
+
global.top = global;
|
|
288
|
+
global.parent = global;
|
|
289
|
+
if (global.global)
|
|
290
|
+
global.global = global;
|
|
291
|
+
skipKeys.forEach((k) => keys.add(k));
|
|
292
|
+
return {
|
|
293
|
+
keys,
|
|
294
|
+
skipKeys,
|
|
295
|
+
originals
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
var jsdom = {
|
|
300
|
+
name: "jsdom",
|
|
301
|
+
async setup(global, { jsdom = {} }) {
|
|
302
|
+
const {
|
|
303
|
+
CookieJar,
|
|
304
|
+
JSDOM,
|
|
305
|
+
ResourceLoader,
|
|
306
|
+
VirtualConsole
|
|
307
|
+
} = await importModule("jsdom");
|
|
308
|
+
const {
|
|
309
|
+
html = "<!DOCTYPE html>",
|
|
310
|
+
userAgent,
|
|
311
|
+
url = "http://localhost:3000",
|
|
312
|
+
contentType = "text/html",
|
|
313
|
+
pretendToBeVisual = true,
|
|
314
|
+
includeNodeLocations = false,
|
|
315
|
+
runScripts = "dangerously",
|
|
316
|
+
resources,
|
|
317
|
+
console = false,
|
|
318
|
+
cookieJar = false,
|
|
319
|
+
...restOptions
|
|
320
|
+
} = jsdom;
|
|
321
|
+
const dom = new JSDOM(
|
|
322
|
+
html,
|
|
323
|
+
{
|
|
324
|
+
pretendToBeVisual,
|
|
325
|
+
resources: resources ?? (userAgent ? new ResourceLoader({ userAgent }) : void 0),
|
|
326
|
+
runScripts,
|
|
327
|
+
url,
|
|
328
|
+
virtualConsole: console && global.console ? new VirtualConsole().sendTo(global.console) : void 0,
|
|
329
|
+
cookieJar: cookieJar ? new CookieJar() : void 0,
|
|
330
|
+
includeNodeLocations,
|
|
331
|
+
contentType,
|
|
332
|
+
userAgent,
|
|
333
|
+
...restOptions
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true });
|
|
337
|
+
return {
|
|
338
|
+
teardown(global2) {
|
|
339
|
+
keys.forEach((key) => delete global2[key]);
|
|
340
|
+
originals.forEach((v, k) => global2[k] = v);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
var happy = {
|
|
347
|
+
name: "happy-dom",
|
|
348
|
+
async setup(global) {
|
|
349
|
+
const { Window, GlobalWindow } = await importModule("happy-dom");
|
|
350
|
+
const win = new (GlobalWindow || Window)();
|
|
351
|
+
const { keys, originals } = populateGlobal(global, win, { bindFunctions: true });
|
|
352
|
+
return {
|
|
353
|
+
teardown(global2) {
|
|
354
|
+
win.happyDOM.cancelAsync();
|
|
355
|
+
keys.forEach((key) => delete global2[key]);
|
|
356
|
+
originals.forEach((v, k) => global2[k] = v);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
var edge = {
|
|
363
|
+
name: "edge-runtime",
|
|
364
|
+
async setup(global) {
|
|
365
|
+
const { EdgeVM } = await importModule("@edge-runtime/vm");
|
|
366
|
+
const vm = new EdgeVM({
|
|
367
|
+
extend: (context) => {
|
|
368
|
+
context.global = context;
|
|
369
|
+
context.Buffer = Buffer;
|
|
370
|
+
return context;
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
const { keys, originals } = populateGlobal(global, vm.context, { bindFunctions: true });
|
|
374
|
+
return {
|
|
375
|
+
teardown(global2) {
|
|
376
|
+
keys.forEach((key) => delete global2[key]);
|
|
377
|
+
originals.forEach((v, k) => global2[k] = v);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
const environments = {
|
|
384
|
+
node,
|
|
385
|
+
jsdom,
|
|
386
|
+
"happy-dom": happy,
|
|
387
|
+
"edge-runtime": edge
|
|
388
|
+
};
|
|
389
|
+
const envs = Object.keys(environments);
|
|
390
|
+
const envPackageNames = {
|
|
391
|
+
"jsdom": "jsdom",
|
|
392
|
+
"happy-dom": "happy-dom",
|
|
393
|
+
"edge-runtime": "@edge-runtime/vm"
|
|
394
|
+
};
|
|
395
|
+
const getEnvPackageName = (env) => {
|
|
396
|
+
if (env === "node")
|
|
397
|
+
return null;
|
|
398
|
+
if (env in envPackageNames)
|
|
399
|
+
return envPackageNames[env];
|
|
400
|
+
return `vitest-environment-${env}`;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
export { envs as a, environments as e, getEnvPackageName as g, populateGlobal as p };
|
|
@@ -3,8 +3,9 @@ import fs$2 from 'fs';
|
|
|
3
3
|
import util from 'util';
|
|
4
4
|
import childProcess$1 from 'child_process';
|
|
5
5
|
import { p as pathKey, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.62ce5c33.mjs';
|
|
6
|
-
import {
|
|
6
|
+
import { o as onetime$1 } from './vendor-index.13e3bda3.mjs';
|
|
7
7
|
import require$$0 from 'os';
|
|
8
|
+
import { s as signalExit } from './vendor-index.731a22f2.mjs';
|
|
8
9
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
9
10
|
import 'buffer';
|
|
10
11
|
import 'stream';
|