vitest 0.16.0 → 0.18.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/dist/{chunk-api-setup.f43cd039.mjs → chunk-api-setup.63babd7c.mjs} +4 -4
- package/dist/{chunk-constants.7b9cfc82.mjs → chunk-constants.8eb2ed35.mjs} +8 -2
- package/dist/chunk-env-node.26c72624.mjs +675 -0
- package/dist/{chunk-install-pkg.3fa50769.mjs → chunk-install-pkg.2dcb2c04.mjs} +1 -1
- package/dist/{chunk-integrations-globals.d0c363a6.mjs → chunk-integrations-globals.61e4d6ae.mjs} +8 -8
- package/dist/{chunk-runtime-chain.7103058b.mjs → chunk-runtime-chain.eb764dff.mjs} +55 -188
- package/dist/{chunk-runtime-mocker.110e3634.mjs → chunk-runtime-mocker.79ccc3de.mjs} +36 -62
- package/dist/{chunk-runtime-rpc.5e78af38.mjs → chunk-runtime-rpc.cc6a06a2.mjs} +1 -1
- package/dist/{chunk-utils-global.79a8b1cc.mjs → chunk-utils-global.1b22c4fd.mjs} +69 -5
- package/dist/{chunk-utils-source-map.2556cba8.mjs → chunk-utils-source-map.957e7756.mjs} +10 -24
- package/dist/{chunk-vite-node-externalize.58e10976.mjs → chunk-vite-node-externalize.0791f2ed.mjs} +2683 -2553
- package/dist/{chunk-vite-node-utils.7450fc0c.mjs → chunk-vite-node-utils.af8ead96.mjs} +28 -13
- package/dist/cli.mjs +15 -15
- package/dist/config.cjs +5 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +5 -1
- package/dist/entry.mjs +8 -8
- package/dist/index.d.ts +223 -18
- package/dist/index.mjs +4 -4
- package/dist/node.d.ts +236 -38
- package/dist/node.mjs +16 -16
- package/dist/{vendor-entry.efeeaa5c.mjs → vendor-entry.78de67ab.mjs} +18 -424
- package/dist/{vendor-index.e5dc6622.mjs → vendor-index.4bf9c627.mjs} +405 -405
- package/dist/{vendor-index.98e769c1.mjs → vendor-index.de788b6a.mjs} +7 -7
- package/dist/worker.mjs +8 -8
- package/package.json +9 -4
- package/dist/chunk-defaults.dc6dc23d.mjs +0 -302
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as globalExpect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter,
|
|
2
|
+
import { v as isNode, a as getWorkerState, R as RealDate, h as safeClearTimeout, f as safeSetTimeout, F as toArray, Q as deepClone, O as getType, u as relative, S as partitionSuiteChildren, E as shuffle, T as hasTests, y as hasFailed, e as getFullName, k as resetModules } from './chunk-utils-global.1b22c4fd.mjs';
|
|
3
|
+
import { d as environments, t as takeCoverage, p as pLimit, f as envs } from './chunk-env-node.26c72624.mjs';
|
|
4
|
+
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as globalExpect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, G as GLOBAL_EXPECT, z as getFn, A as getState } from './chunk-runtime-chain.eb764dff.mjs';
|
|
5
5
|
import chai, { assert, should, util } from 'chai';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
7
|
-
import { t as takeCoverage, p as pLimit } from './chunk-defaults.dc6dc23d.mjs';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.cc6a06a2.mjs';
|
|
8
7
|
import { format } from 'util';
|
|
9
|
-
import { s as stringify } from './chunk-utils-source-map.
|
|
8
|
+
import { s as stringify } from './chunk-utils-source-map.957e7756.mjs';
|
|
10
9
|
|
|
11
10
|
var index = /*#__PURE__*/Object.freeze({
|
|
12
11
|
__proto__: null,
|
|
@@ -32,398 +31,6 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
32
31
|
isWatchMode: isWatchMode
|
|
33
32
|
});
|
|
34
33
|
|
|
35
|
-
var node = {
|
|
36
|
-
name: "node",
|
|
37
|
-
async setup() {
|
|
38
|
-
return {
|
|
39
|
-
teardown() {
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const LIVING_KEYS = [
|
|
46
|
-
"DOMException",
|
|
47
|
-
"URL",
|
|
48
|
-
"URLSearchParams",
|
|
49
|
-
"EventTarget",
|
|
50
|
-
"NamedNodeMap",
|
|
51
|
-
"Node",
|
|
52
|
-
"Attr",
|
|
53
|
-
"Element",
|
|
54
|
-
"DocumentFragment",
|
|
55
|
-
"DOMImplementation",
|
|
56
|
-
"Document",
|
|
57
|
-
"XMLDocument",
|
|
58
|
-
"CharacterData",
|
|
59
|
-
"Text",
|
|
60
|
-
"CDATASection",
|
|
61
|
-
"ProcessingInstruction",
|
|
62
|
-
"Comment",
|
|
63
|
-
"DocumentType",
|
|
64
|
-
"NodeList",
|
|
65
|
-
"HTMLCollection",
|
|
66
|
-
"HTMLOptionsCollection",
|
|
67
|
-
"DOMStringMap",
|
|
68
|
-
"DOMTokenList",
|
|
69
|
-
"StyleSheetList",
|
|
70
|
-
"HTMLElement",
|
|
71
|
-
"HTMLHeadElement",
|
|
72
|
-
"HTMLTitleElement",
|
|
73
|
-
"HTMLBaseElement",
|
|
74
|
-
"HTMLLinkElement",
|
|
75
|
-
"HTMLMetaElement",
|
|
76
|
-
"HTMLStyleElement",
|
|
77
|
-
"HTMLBodyElement",
|
|
78
|
-
"HTMLHeadingElement",
|
|
79
|
-
"HTMLParagraphElement",
|
|
80
|
-
"HTMLHRElement",
|
|
81
|
-
"HTMLPreElement",
|
|
82
|
-
"HTMLUListElement",
|
|
83
|
-
"HTMLOListElement",
|
|
84
|
-
"HTMLLIElement",
|
|
85
|
-
"HTMLMenuElement",
|
|
86
|
-
"HTMLDListElement",
|
|
87
|
-
"HTMLDivElement",
|
|
88
|
-
"HTMLAnchorElement",
|
|
89
|
-
"HTMLAreaElement",
|
|
90
|
-
"HTMLBRElement",
|
|
91
|
-
"HTMLButtonElement",
|
|
92
|
-
"HTMLCanvasElement",
|
|
93
|
-
"HTMLDataElement",
|
|
94
|
-
"HTMLDataListElement",
|
|
95
|
-
"HTMLDetailsElement",
|
|
96
|
-
"HTMLDialogElement",
|
|
97
|
-
"HTMLDirectoryElement",
|
|
98
|
-
"HTMLFieldSetElement",
|
|
99
|
-
"HTMLFontElement",
|
|
100
|
-
"HTMLFormElement",
|
|
101
|
-
"HTMLHtmlElement",
|
|
102
|
-
"HTMLImageElement",
|
|
103
|
-
"HTMLInputElement",
|
|
104
|
-
"HTMLLabelElement",
|
|
105
|
-
"HTMLLegendElement",
|
|
106
|
-
"HTMLMapElement",
|
|
107
|
-
"HTMLMarqueeElement",
|
|
108
|
-
"HTMLMediaElement",
|
|
109
|
-
"HTMLMeterElement",
|
|
110
|
-
"HTMLModElement",
|
|
111
|
-
"HTMLOptGroupElement",
|
|
112
|
-
"HTMLOptionElement",
|
|
113
|
-
"HTMLOutputElement",
|
|
114
|
-
"HTMLPictureElement",
|
|
115
|
-
"HTMLProgressElement",
|
|
116
|
-
"HTMLQuoteElement",
|
|
117
|
-
"HTMLScriptElement",
|
|
118
|
-
"HTMLSelectElement",
|
|
119
|
-
"HTMLSlotElement",
|
|
120
|
-
"HTMLSourceElement",
|
|
121
|
-
"HTMLSpanElement",
|
|
122
|
-
"HTMLTableCaptionElement",
|
|
123
|
-
"HTMLTableCellElement",
|
|
124
|
-
"HTMLTableColElement",
|
|
125
|
-
"HTMLTableElement",
|
|
126
|
-
"HTMLTimeElement",
|
|
127
|
-
"HTMLTableRowElement",
|
|
128
|
-
"HTMLTableSectionElement",
|
|
129
|
-
"HTMLTemplateElement",
|
|
130
|
-
"HTMLTextAreaElement",
|
|
131
|
-
"HTMLUnknownElement",
|
|
132
|
-
"HTMLFrameElement",
|
|
133
|
-
"HTMLFrameSetElement",
|
|
134
|
-
"HTMLIFrameElement",
|
|
135
|
-
"HTMLEmbedElement",
|
|
136
|
-
"HTMLObjectElement",
|
|
137
|
-
"HTMLParamElement",
|
|
138
|
-
"HTMLVideoElement",
|
|
139
|
-
"HTMLAudioElement",
|
|
140
|
-
"HTMLTrackElement",
|
|
141
|
-
"SVGElement",
|
|
142
|
-
"SVGGraphicsElement",
|
|
143
|
-
"SVGSVGElement",
|
|
144
|
-
"SVGTitleElement",
|
|
145
|
-
"SVGAnimatedString",
|
|
146
|
-
"SVGNumber",
|
|
147
|
-
"SVGStringList",
|
|
148
|
-
"Event",
|
|
149
|
-
"CloseEvent",
|
|
150
|
-
"CustomEvent",
|
|
151
|
-
"MessageEvent",
|
|
152
|
-
"ErrorEvent",
|
|
153
|
-
"HashChangeEvent",
|
|
154
|
-
"PopStateEvent",
|
|
155
|
-
"StorageEvent",
|
|
156
|
-
"ProgressEvent",
|
|
157
|
-
"PageTransitionEvent",
|
|
158
|
-
"UIEvent",
|
|
159
|
-
"FocusEvent",
|
|
160
|
-
"InputEvent",
|
|
161
|
-
"MouseEvent",
|
|
162
|
-
"KeyboardEvent",
|
|
163
|
-
"TouchEvent",
|
|
164
|
-
"CompositionEvent",
|
|
165
|
-
"WheelEvent",
|
|
166
|
-
"BarProp",
|
|
167
|
-
"External",
|
|
168
|
-
"Location",
|
|
169
|
-
"History",
|
|
170
|
-
"Screen",
|
|
171
|
-
"Performance",
|
|
172
|
-
"Navigator",
|
|
173
|
-
"PluginArray",
|
|
174
|
-
"MimeTypeArray",
|
|
175
|
-
"Plugin",
|
|
176
|
-
"MimeType",
|
|
177
|
-
"FileReader",
|
|
178
|
-
"Blob",
|
|
179
|
-
"File",
|
|
180
|
-
"FileList",
|
|
181
|
-
"ValidityState",
|
|
182
|
-
"DOMParser",
|
|
183
|
-
"XMLSerializer",
|
|
184
|
-
"FormData",
|
|
185
|
-
"XMLHttpRequestEventTarget",
|
|
186
|
-
"XMLHttpRequestUpload",
|
|
187
|
-
"XMLHttpRequest",
|
|
188
|
-
"WebSocket",
|
|
189
|
-
"NodeFilter",
|
|
190
|
-
"NodeIterator",
|
|
191
|
-
"TreeWalker",
|
|
192
|
-
"AbstractRange",
|
|
193
|
-
"Range",
|
|
194
|
-
"StaticRange",
|
|
195
|
-
"Selection",
|
|
196
|
-
"Storage",
|
|
197
|
-
"CustomElementRegistry",
|
|
198
|
-
"ShadowRoot",
|
|
199
|
-
"MutationObserver",
|
|
200
|
-
"MutationRecord",
|
|
201
|
-
"Headers",
|
|
202
|
-
"AbortController",
|
|
203
|
-
"AbortSignal",
|
|
204
|
-
"Image",
|
|
205
|
-
"Audio",
|
|
206
|
-
"Option"
|
|
207
|
-
];
|
|
208
|
-
const OTHER_KEYS = [
|
|
209
|
-
"addEventListener",
|
|
210
|
-
"alert",
|
|
211
|
-
"atob",
|
|
212
|
-
"blur",
|
|
213
|
-
"btoa",
|
|
214
|
-
"cancelAnimationFrame",
|
|
215
|
-
"close",
|
|
216
|
-
"confirm",
|
|
217
|
-
"createPopup",
|
|
218
|
-
"dispatchEvent",
|
|
219
|
-
"document",
|
|
220
|
-
"focus",
|
|
221
|
-
"frames",
|
|
222
|
-
"getComputedStyle",
|
|
223
|
-
"history",
|
|
224
|
-
"innerHeight",
|
|
225
|
-
"innerWidth",
|
|
226
|
-
"length",
|
|
227
|
-
"location",
|
|
228
|
-
"matchMedia",
|
|
229
|
-
"moveBy",
|
|
230
|
-
"moveTo",
|
|
231
|
-
"name",
|
|
232
|
-
"navigator",
|
|
233
|
-
"open",
|
|
234
|
-
"outerHeight",
|
|
235
|
-
"outerWidth",
|
|
236
|
-
"pageXOffset",
|
|
237
|
-
"pageYOffset",
|
|
238
|
-
"parent",
|
|
239
|
-
"postMessage",
|
|
240
|
-
"print",
|
|
241
|
-
"prompt",
|
|
242
|
-
"removeEventListener",
|
|
243
|
-
"requestAnimationFrame",
|
|
244
|
-
"resizeBy",
|
|
245
|
-
"resizeTo",
|
|
246
|
-
"screen",
|
|
247
|
-
"screenLeft",
|
|
248
|
-
"screenTop",
|
|
249
|
-
"screenX",
|
|
250
|
-
"screenY",
|
|
251
|
-
"scroll",
|
|
252
|
-
"scrollBy",
|
|
253
|
-
"scrollLeft",
|
|
254
|
-
"scrollTo",
|
|
255
|
-
"scrollTop",
|
|
256
|
-
"scrollX",
|
|
257
|
-
"scrollY",
|
|
258
|
-
"self",
|
|
259
|
-
"stop",
|
|
260
|
-
"top",
|
|
261
|
-
"Window",
|
|
262
|
-
"window"
|
|
263
|
-
];
|
|
264
|
-
const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
|
|
265
|
-
|
|
266
|
-
const allowRewrite = [
|
|
267
|
-
"Event",
|
|
268
|
-
"EventTarget"
|
|
269
|
-
];
|
|
270
|
-
const skipKeys = [
|
|
271
|
-
"window",
|
|
272
|
-
"self",
|
|
273
|
-
"top",
|
|
274
|
-
"parent"
|
|
275
|
-
];
|
|
276
|
-
function getWindowKeys(global, win) {
|
|
277
|
-
const keys = new Set(KEYS.concat(Object.getOwnPropertyNames(win)).filter((k) => {
|
|
278
|
-
if (skipKeys.includes(k))
|
|
279
|
-
return false;
|
|
280
|
-
if (k in global)
|
|
281
|
-
return allowRewrite.includes(k);
|
|
282
|
-
return true;
|
|
283
|
-
}));
|
|
284
|
-
return keys;
|
|
285
|
-
}
|
|
286
|
-
function isClassLikeName(name) {
|
|
287
|
-
return name[0] === name[0].toUpperCase();
|
|
288
|
-
}
|
|
289
|
-
function populateGlobal(global, win, options = {}) {
|
|
290
|
-
const { bindFunctions = false } = options;
|
|
291
|
-
const keys = getWindowKeys(global, win);
|
|
292
|
-
const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
|
|
293
|
-
const overrideObject = /* @__PURE__ */ new Map();
|
|
294
|
-
for (const key of keys) {
|
|
295
|
-
const boundFunction = bindFunctions && typeof win[key] === "function" && !isClassLikeName(key) && win[key].bind(win);
|
|
296
|
-
Object.defineProperty(global, key, {
|
|
297
|
-
get() {
|
|
298
|
-
if (overrideObject.has(key))
|
|
299
|
-
return overrideObject.get(key);
|
|
300
|
-
if (boundFunction)
|
|
301
|
-
return boundFunction;
|
|
302
|
-
return win[key];
|
|
303
|
-
},
|
|
304
|
-
set(v) {
|
|
305
|
-
overrideObject.set(key, v);
|
|
306
|
-
},
|
|
307
|
-
configurable: true
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
global.window = global;
|
|
311
|
-
global.self = global;
|
|
312
|
-
global.top = global;
|
|
313
|
-
global.parent = global;
|
|
314
|
-
if (global.global)
|
|
315
|
-
global.global = global;
|
|
316
|
-
skipKeys.forEach((k) => keys.add(k));
|
|
317
|
-
return {
|
|
318
|
-
keys,
|
|
319
|
-
skipKeys,
|
|
320
|
-
originals
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
var __defProp$1 = Object.defineProperty;
|
|
325
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
326
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
327
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
328
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
329
|
-
var __spreadValues$1 = (a, b) => {
|
|
330
|
-
for (var prop in b || (b = {}))
|
|
331
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
332
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
333
|
-
if (__getOwnPropSymbols$1)
|
|
334
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
335
|
-
if (__propIsEnum$1.call(b, prop))
|
|
336
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
337
|
-
}
|
|
338
|
-
return a;
|
|
339
|
-
};
|
|
340
|
-
var __objRest = (source, exclude) => {
|
|
341
|
-
var target = {};
|
|
342
|
-
for (var prop in source)
|
|
343
|
-
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
344
|
-
target[prop] = source[prop];
|
|
345
|
-
if (source != null && __getOwnPropSymbols$1)
|
|
346
|
-
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
347
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
348
|
-
target[prop] = source[prop];
|
|
349
|
-
}
|
|
350
|
-
return target;
|
|
351
|
-
};
|
|
352
|
-
var jsdom = {
|
|
353
|
-
name: "jsdom",
|
|
354
|
-
async setup(global, { jsdom = {} }) {
|
|
355
|
-
const {
|
|
356
|
-
CookieJar,
|
|
357
|
-
JSDOM,
|
|
358
|
-
ResourceLoader,
|
|
359
|
-
VirtualConsole
|
|
360
|
-
} = await importModule("jsdom");
|
|
361
|
-
const _a = jsdom, {
|
|
362
|
-
html = "<!DOCTYPE html>",
|
|
363
|
-
userAgent,
|
|
364
|
-
url = "http://localhost:3000",
|
|
365
|
-
contentType = "text/html",
|
|
366
|
-
pretendToBeVisual = true,
|
|
367
|
-
includeNodeLocations = false,
|
|
368
|
-
runScripts = "dangerously",
|
|
369
|
-
resources,
|
|
370
|
-
console = false,
|
|
371
|
-
cookieJar = false
|
|
372
|
-
} = _a, restOptions = __objRest(_a, [
|
|
373
|
-
"html",
|
|
374
|
-
"userAgent",
|
|
375
|
-
"url",
|
|
376
|
-
"contentType",
|
|
377
|
-
"pretendToBeVisual",
|
|
378
|
-
"includeNodeLocations",
|
|
379
|
-
"runScripts",
|
|
380
|
-
"resources",
|
|
381
|
-
"console",
|
|
382
|
-
"cookieJar"
|
|
383
|
-
]);
|
|
384
|
-
const dom = new JSDOM(html, __spreadValues$1({
|
|
385
|
-
pretendToBeVisual,
|
|
386
|
-
resources: resources ?? (userAgent ? new ResourceLoader({ userAgent }) : void 0),
|
|
387
|
-
runScripts,
|
|
388
|
-
url,
|
|
389
|
-
virtualConsole: console && global.console ? new VirtualConsole().sendTo(global.console) : void 0,
|
|
390
|
-
cookieJar: cookieJar ? new CookieJar() : void 0,
|
|
391
|
-
includeNodeLocations,
|
|
392
|
-
contentType,
|
|
393
|
-
userAgent
|
|
394
|
-
}, restOptions));
|
|
395
|
-
const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true });
|
|
396
|
-
return {
|
|
397
|
-
teardown(global2) {
|
|
398
|
-
keys.forEach((key) => delete global2[key]);
|
|
399
|
-
originals.forEach((v, k) => global2[k] = v);
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
var happy = {
|
|
406
|
-
name: "happy-dom",
|
|
407
|
-
async setup(global) {
|
|
408
|
-
const { Window, GlobalWindow } = await importModule("happy-dom");
|
|
409
|
-
const win = new (GlobalWindow || Window)();
|
|
410
|
-
const { keys, originals } = populateGlobal(global, win, { bindFunctions: true });
|
|
411
|
-
return {
|
|
412
|
-
teardown(global2) {
|
|
413
|
-
win.happyDOM.cancelAsync();
|
|
414
|
-
keys.forEach((key) => delete global2[key]);
|
|
415
|
-
originals.forEach((v, k) => global2[k] = v);
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
const environments = {
|
|
422
|
-
node,
|
|
423
|
-
jsdom,
|
|
424
|
-
"happy-dom": happy
|
|
425
|
-
};
|
|
426
|
-
|
|
427
34
|
let globalSetup = false;
|
|
428
35
|
async function setupGlobalEnv(config) {
|
|
429
36
|
resetRunOnceCounter();
|
|
@@ -438,7 +45,7 @@ async function setupGlobalEnv(config) {
|
|
|
438
45
|
if (isNode)
|
|
439
46
|
await setupConsoleLogSpy();
|
|
440
47
|
if (config.globals)
|
|
441
|
-
(await import('./chunk-integrations-globals.
|
|
48
|
+
(await import('./chunk-integrations-globals.61e4d6ae.mjs')).registerApiGlobally();
|
|
442
49
|
}
|
|
443
50
|
function setupDefines(defines) {
|
|
444
51
|
for (const key in defines)
|
|
@@ -560,9 +167,9 @@ async function withEnv(name, options, fn) {
|
|
|
560
167
|
}
|
|
561
168
|
async function runSetupFiles(config) {
|
|
562
169
|
const files = toArray(config.setupFiles);
|
|
563
|
-
await Promise.all(files.map(async (
|
|
564
|
-
getWorkerState().moduleCache.delete(
|
|
565
|
-
await import(
|
|
170
|
+
await Promise.all(files.map(async (fsPath) => {
|
|
171
|
+
getWorkerState().moduleCache.delete(fsPath);
|
|
172
|
+
await import(fsPath);
|
|
566
173
|
}));
|
|
567
174
|
}
|
|
568
175
|
|
|
@@ -792,25 +399,6 @@ function calculateHash(parent) {
|
|
|
792
399
|
});
|
|
793
400
|
}
|
|
794
401
|
|
|
795
|
-
var __defProp = Object.defineProperty;
|
|
796
|
-
var __defProps = Object.defineProperties;
|
|
797
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
798
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
799
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
800
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
801
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
802
|
-
var __spreadValues = (a, b) => {
|
|
803
|
-
for (var prop in b || (b = {}))
|
|
804
|
-
if (__hasOwnProp.call(b, prop))
|
|
805
|
-
__defNormalProp(a, prop, b[prop]);
|
|
806
|
-
if (__getOwnPropSymbols)
|
|
807
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
808
|
-
if (__propIsEnum.call(b, prop))
|
|
809
|
-
__defNormalProp(a, prop, b[prop]);
|
|
810
|
-
}
|
|
811
|
-
return a;
|
|
812
|
-
};
|
|
813
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
814
402
|
const now = Date.now;
|
|
815
403
|
function updateSuiteHookState(suite, name, state) {
|
|
816
404
|
var _a;
|
|
@@ -931,7 +519,7 @@ async function runTest(test) {
|
|
|
931
519
|
function markTasksAsSkipped(suite) {
|
|
932
520
|
suite.tasks.forEach((t) => {
|
|
933
521
|
t.mode = "skip";
|
|
934
|
-
t.result =
|
|
522
|
+
t.result = { ...t.result, state: "skip" };
|
|
935
523
|
updateTask(t);
|
|
936
524
|
if (t.type === "suite")
|
|
937
525
|
markTasksAsSkipped(t);
|
|
@@ -958,11 +546,18 @@ async function runSuite(suite) {
|
|
|
958
546
|
} else {
|
|
959
547
|
try {
|
|
960
548
|
const beforeAllCleanups = await callSuiteHook(suite, suite, "beforeAll", [suite]);
|
|
961
|
-
for (
|
|
549
|
+
for (let tasksGroup of partitionSuiteChildren(suite)) {
|
|
962
550
|
if (tasksGroup[0].concurrent === true) {
|
|
963
551
|
const mutex = pLimit(workerState.config.maxConcurrency);
|
|
964
552
|
await Promise.all(tasksGroup.map((c) => mutex(() => runSuiteChild(c))));
|
|
965
553
|
} else {
|
|
554
|
+
const { sequence } = workerState.config;
|
|
555
|
+
if (sequence.shuffle || suite.shuffle) {
|
|
556
|
+
const suites = tasksGroup.filter((group) => group.type === "suite");
|
|
557
|
+
const tests = tasksGroup.filter((group) => group.type === "test");
|
|
558
|
+
const groups = shuffle([suites, tests], sequence.seed);
|
|
559
|
+
tasksGroup = groups.flatMap((group) => shuffle(group, sequence.seed));
|
|
560
|
+
}
|
|
966
561
|
for (const c of tasksGroup)
|
|
967
562
|
await runSuiteChild(c);
|
|
968
563
|
}
|
|
@@ -1029,7 +624,6 @@ function clearModuleMocks() {
|
|
|
1029
624
|
async function run(files, config) {
|
|
1030
625
|
await setupGlobalEnv(config);
|
|
1031
626
|
const workerState = getWorkerState();
|
|
1032
|
-
const envs = ["node", "jsdom", "happy-dom"];
|
|
1033
627
|
const filesWithEnv = await Promise.all(files.map(async (file) => {
|
|
1034
628
|
var _a;
|
|
1035
629
|
const code = await promises.readFile(file, "utf-8");
|