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.
Files changed (50) hide show
  1. package/LICENSE.md +61 -33
  2. package/dist/browser.d.ts +5 -5
  3. package/dist/browser.mjs +12 -10
  4. package/dist/{chunk-api-setup.7a6ba7fb.mjs → chunk-api-setup.5fc06d1d.mjs} +94 -91
  5. package/dist/chunk-constants.6196597b.mjs +284 -0
  6. package/dist/chunk-env-node.ceb43f1c.mjs +403 -0
  7. package/dist/{chunk-install-pkg.6c6dc0c2.mjs → chunk-install-pkg.e081fc1b.mjs} +2 -1
  8. package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
  9. package/dist/{chunk-integrations-globals.44a8f047.mjs → chunk-integrations-globals.ef598c23.mjs} +8 -9
  10. package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
  11. package/dist/chunk-mock-date.0d86eaa5.mjs +332 -0
  12. package/dist/chunk-node-git.6f289b0a.mjs +84 -0
  13. package/dist/{chunk-runtime-chain.98d42d89.mjs → chunk-runtime-chain.2af36ddf.mjs} +507 -172
  14. package/dist/{chunk-runtime-error.87a2b5a2.mjs → chunk-runtime-error.ed9b4f70.mjs} +208 -76
  15. package/dist/{chunk-runtime-hooks.453f8858.mjs → chunk-runtime-hooks.75ce0575.mjs} +18 -12
  16. package/dist/{chunk-runtime-mocker.23b62bfa.mjs → chunk-runtime-mocker.fc76f21d.mjs} +18 -11
  17. package/dist/{chunk-runtime-rpc.b50ab560.mjs → chunk-runtime-rpc.3fe371e9.mjs} +1 -2
  18. package/dist/{chunk-utils-source-map.94107ee8.mjs → chunk-utils-source-map.70ee97e1.mjs} +11 -4
  19. package/dist/{chunk-vite-node-client.fdd9592c.mjs → chunk-vite-node-client.74ebe3d5.mjs} +97 -31
  20. package/dist/{chunk-vite-node-debug.09afb76f.mjs → chunk-vite-node-debug.2d8a1dc3.mjs} +3 -3
  21. package/dist/{chunk-vite-node-externalize.27aee038.mjs → chunk-vite-node-externalize.41bf722e.mjs} +644 -222
  22. package/dist/{chunk-vite-node-utils.f34df9d3.mjs → chunk-vite-node-utils.68573626.mjs} +60 -42
  23. package/dist/cli-wrapper.mjs +128 -0
  24. package/dist/cli.mjs +29 -20
  25. package/dist/config.cjs +5 -2
  26. package/dist/config.d.ts +8 -4
  27. package/dist/config.mjs +4 -3
  28. package/dist/entry.mjs +20 -15
  29. package/dist/environments.d.ts +23 -0
  30. package/dist/environments.mjs +3 -0
  31. package/dist/{global-60f880c6.d.ts → global-ea084c9f.d.ts} +627 -178
  32. package/dist/{index-4a906fa4.d.ts → index-5f09f4d0.d.ts} +3 -50
  33. package/dist/index.d.ts +6 -6
  34. package/dist/index.mjs +7 -6
  35. package/dist/loader.mjs +3 -3
  36. package/dist/node.d.ts +5 -4
  37. package/dist/node.mjs +19 -16
  38. package/dist/suite.mjs +6 -5
  39. package/dist/vendor-index.0557b03a.mjs +147 -0
  40. package/dist/vendor-index.13e3bda3.mjs +61 -0
  41. package/dist/{chunk-node-git.c2be9c49.mjs → vendor-index.4aeeb598.mjs} +4 -72
  42. package/dist/{vendor-index.61438b77.mjs → vendor-index.731a22f2.mjs} +1 -61
  43. package/dist/worker.mjs +20 -18
  44. package/package.json +19 -16
  45. package/vitest.mjs +1 -1
  46. package/dist/chunk-constants.26dc9f85.mjs +0 -38
  47. package/dist/chunk-defaults.02abff90.mjs +0 -680
  48. package/dist/chunk-mock-date.bc81a3ac.mjs +0 -555
  49. package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
  50. package/dist/mocker-5e2a8e41.d.ts +0 -3
@@ -1,680 +0,0 @@
1
- import { existsSync, promises } from 'fs';
2
- import { createRequire } from 'module';
3
- import _url from 'url';
4
- import { t as toArray, y as resolve } from './chunk-mock-date.bc81a3ac.mjs';
5
- import { importModule } from 'local-pkg';
6
-
7
- /*
8
- How it works:
9
- `this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.
10
- */
11
-
12
- class Node {
13
- value;
14
- next;
15
-
16
- constructor(value) {
17
- this.value = value;
18
- }
19
- }
20
-
21
- class Queue {
22
- #head;
23
- #tail;
24
- #size;
25
-
26
- constructor() {
27
- this.clear();
28
- }
29
-
30
- enqueue(value) {
31
- const node = new Node(value);
32
-
33
- if (this.#head) {
34
- this.#tail.next = node;
35
- this.#tail = node;
36
- } else {
37
- this.#head = node;
38
- this.#tail = node;
39
- }
40
-
41
- this.#size++;
42
- }
43
-
44
- dequeue() {
45
- const current = this.#head;
46
- if (!current) {
47
- return;
48
- }
49
-
50
- this.#head = this.#head.next;
51
- this.#size--;
52
- return current.value;
53
- }
54
-
55
- clear() {
56
- this.#head = undefined;
57
- this.#tail = undefined;
58
- this.#size = 0;
59
- }
60
-
61
- get size() {
62
- return this.#size;
63
- }
64
-
65
- * [Symbol.iterator]() {
66
- let current = this.#head;
67
-
68
- while (current) {
69
- yield current.value;
70
- current = current.next;
71
- }
72
- }
73
- }
74
-
75
- function pLimit(concurrency) {
76
- if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
77
- throw new TypeError('Expected `concurrency` to be a number from 1 and up');
78
- }
79
-
80
- const queue = new Queue();
81
- let activeCount = 0;
82
-
83
- const next = () => {
84
- activeCount--;
85
-
86
- if (queue.size > 0) {
87
- queue.dequeue()();
88
- }
89
- };
90
-
91
- const run = async (fn, resolve, args) => {
92
- activeCount++;
93
-
94
- const result = (async () => fn(...args))();
95
-
96
- resolve(result);
97
-
98
- try {
99
- await result;
100
- } catch {}
101
-
102
- next();
103
- };
104
-
105
- const enqueue = (fn, resolve, args) => {
106
- queue.enqueue(run.bind(undefined, fn, resolve, args));
107
-
108
- (async () => {
109
- // This function needs to wait until the next microtask before comparing
110
- // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
111
- // when the run function is dequeued and called. The comparison in the if-statement
112
- // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
113
- await Promise.resolve();
114
-
115
- if (activeCount < concurrency && queue.size > 0) {
116
- queue.dequeue()();
117
- }
118
- })();
119
- };
120
-
121
- const generator = (fn, ...args) => new Promise(resolve => {
122
- enqueue(fn, resolve, args);
123
- });
124
-
125
- Object.defineProperties(generator, {
126
- activeCount: {
127
- get: () => activeCount,
128
- },
129
- pendingCount: {
130
- get: () => queue.size,
131
- },
132
- clearQueue: {
133
- value: () => {
134
- queue.clear();
135
- },
136
- },
137
- });
138
-
139
- return generator;
140
- }
141
-
142
- const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
143
- const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
144
- const defaultCoverageExcludes = [
145
- "coverage/**",
146
- "dist/**",
147
- "packages/*/test{,s}/**",
148
- "**/*.d.ts",
149
- "cypress/**",
150
- "test{,s}/**",
151
- "test{,-*}.{js,cjs,mjs,ts,tsx,jsx}",
152
- "**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}",
153
- "**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}",
154
- "**/__tests__/**",
155
- "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.{js,cjs,mjs,ts}",
156
- "**/.{eslint,mocha,prettier}rc.{js,cjs,yml}"
157
- ];
158
- const coverageConfigDefaults = {
159
- enabled: false,
160
- clean: true,
161
- cleanOnRerun: false,
162
- reportsDirectory: "./coverage",
163
- excludeNodeModules: true,
164
- exclude: defaultCoverageExcludes,
165
- reporter: ["text", "html", "clover"],
166
- allowExternal: false,
167
- extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
168
- };
169
- const fakeTimersDefaults = {
170
- loopLimit: 1e4,
171
- shouldClearNativeTimers: true,
172
- toFake: [
173
- "setTimeout",
174
- "clearTimeout",
175
- "setInterval",
176
- "clearInterval",
177
- "setImmediate",
178
- "clearImmediate",
179
- "Date"
180
- ]
181
- };
182
- const config = {
183
- allowOnly: !process.env.CI,
184
- watch: !process.env.CI,
185
- globals: false,
186
- environment: "node",
187
- threads: true,
188
- clearMocks: false,
189
- restoreMocks: false,
190
- mockReset: false,
191
- include: defaultInclude,
192
- exclude: defaultExclude,
193
- testTimeout: 5e3,
194
- hookTimeout: 1e4,
195
- teardownTimeout: 1e3,
196
- isolate: true,
197
- watchExclude: ["**/node_modules/**", "**/dist/**"],
198
- forceRerunTriggers: [
199
- "**/package.json/**",
200
- "**/vitest.config.*/**",
201
- "**/vite.config.*/**"
202
- ],
203
- update: false,
204
- reporters: [],
205
- silent: false,
206
- api: false,
207
- ui: false,
208
- uiBase: "/__vitest__/",
209
- open: true,
210
- css: {
211
- include: [/\.module\./]
212
- },
213
- coverage: coverageConfigDefaults,
214
- fakeTimers: fakeTimersDefaults,
215
- maxConcurrency: 5,
216
- dangerouslyIgnoreUnhandledErrors: false
217
- };
218
- const configDefaults = Object.freeze(config);
219
-
220
- function resolveC8Options(options, root) {
221
- const resolved = {
222
- ...configDefaults.coverage,
223
- ...options
224
- };
225
- resolved.reporter = toArray(resolved.reporter);
226
- resolved.reportsDirectory = resolve(root, resolved.reportsDirectory);
227
- resolved.tempDirectory = process.env.NODE_V8_COVERAGE || resolve(resolved.reportsDirectory, "tmp");
228
- return resolved;
229
- }
230
- async function cleanCoverage(options, clean = true) {
231
- if (clean && existsSync(options.reportsDirectory))
232
- await promises.rm(options.reportsDirectory, { recursive: true, force: true });
233
- if (!existsSync(options.tempDirectory))
234
- await promises.mkdir(options.tempDirectory, { recursive: true });
235
- }
236
- const require = createRequire(import.meta.url);
237
- function takeCoverage() {
238
- const v8 = require("v8");
239
- if (v8.takeCoverage == null)
240
- console.warn("[Vitest] takeCoverage is not available in this NodeJs version.\nCoverage could be incomplete. Update to NodeJs 14.18.");
241
- else
242
- v8.takeCoverage();
243
- }
244
- async function reportCoverage(ctx) {
245
- takeCoverage();
246
- const createReport = require("c8/lib/report");
247
- const report = createReport(ctx.config.coverage);
248
- const sourceMapMeta = {};
249
- await Promise.all(Array.from(ctx.vitenode.fetchCache.entries()).filter((i) => !i[0].includes("/node_modules/")).map(async ([file, { result }]) => {
250
- const map = result.map;
251
- if (!map)
252
- return;
253
- const url = _url.pathToFileURL(file).href;
254
- let code;
255
- try {
256
- code = (await promises.readFile(file)).toString();
257
- } catch {
258
- }
259
- const sources = [url];
260
- sourceMapMeta[url] = {
261
- source: result.code,
262
- map: {
263
- sourcesContent: code ? [code] : void 0,
264
- ...map,
265
- sources
266
- }
267
- };
268
- }));
269
- const offset = 224;
270
- report._getSourceMap = (coverage) => {
271
- const path = _url.pathToFileURL(coverage.url).href;
272
- const data = sourceMapMeta[path];
273
- if (!data)
274
- return {};
275
- return {
276
- sourceMap: {
277
- sourcemap: data.map
278
- },
279
- source: Array(offset).fill(".").join("") + data.source
280
- };
281
- };
282
- await report.run();
283
- if (ctx.config.coverage.enabled) {
284
- if (ctx.config.coverage["100"]) {
285
- ctx.config.coverage.lines = 100;
286
- ctx.config.coverage.functions = 100;
287
- ctx.config.coverage.branches = 100;
288
- ctx.config.coverage.statements = 100;
289
- }
290
- const { checkCoverages } = require("c8/lib/commands/check-coverage");
291
- await checkCoverages(ctx.config.coverage, report);
292
- }
293
- }
294
-
295
- var node = {
296
- name: "node",
297
- async setup() {
298
- return {
299
- teardown() {
300
- }
301
- };
302
- }
303
- };
304
-
305
- const LIVING_KEYS = [
306
- "DOMException",
307
- "URL",
308
- "URLSearchParams",
309
- "EventTarget",
310
- "NamedNodeMap",
311
- "Node",
312
- "Attr",
313
- "Element",
314
- "DocumentFragment",
315
- "DOMImplementation",
316
- "Document",
317
- "XMLDocument",
318
- "CharacterData",
319
- "Text",
320
- "CDATASection",
321
- "ProcessingInstruction",
322
- "Comment",
323
- "DocumentType",
324
- "NodeList",
325
- "HTMLCollection",
326
- "HTMLOptionsCollection",
327
- "DOMStringMap",
328
- "DOMTokenList",
329
- "StyleSheetList",
330
- "HTMLElement",
331
- "HTMLHeadElement",
332
- "HTMLTitleElement",
333
- "HTMLBaseElement",
334
- "HTMLLinkElement",
335
- "HTMLMetaElement",
336
- "HTMLStyleElement",
337
- "HTMLBodyElement",
338
- "HTMLHeadingElement",
339
- "HTMLParagraphElement",
340
- "HTMLHRElement",
341
- "HTMLPreElement",
342
- "HTMLUListElement",
343
- "HTMLOListElement",
344
- "HTMLLIElement",
345
- "HTMLMenuElement",
346
- "HTMLDListElement",
347
- "HTMLDivElement",
348
- "HTMLAnchorElement",
349
- "HTMLAreaElement",
350
- "HTMLBRElement",
351
- "HTMLButtonElement",
352
- "HTMLCanvasElement",
353
- "HTMLDataElement",
354
- "HTMLDataListElement",
355
- "HTMLDetailsElement",
356
- "HTMLDialogElement",
357
- "HTMLDirectoryElement",
358
- "HTMLFieldSetElement",
359
- "HTMLFontElement",
360
- "HTMLFormElement",
361
- "HTMLHtmlElement",
362
- "HTMLImageElement",
363
- "HTMLInputElement",
364
- "HTMLLabelElement",
365
- "HTMLLegendElement",
366
- "HTMLMapElement",
367
- "HTMLMarqueeElement",
368
- "HTMLMediaElement",
369
- "HTMLMeterElement",
370
- "HTMLModElement",
371
- "HTMLOptGroupElement",
372
- "HTMLOptionElement",
373
- "HTMLOutputElement",
374
- "HTMLPictureElement",
375
- "HTMLProgressElement",
376
- "HTMLQuoteElement",
377
- "HTMLScriptElement",
378
- "HTMLSelectElement",
379
- "HTMLSlotElement",
380
- "HTMLSourceElement",
381
- "HTMLSpanElement",
382
- "HTMLTableCaptionElement",
383
- "HTMLTableCellElement",
384
- "HTMLTableColElement",
385
- "HTMLTableElement",
386
- "HTMLTimeElement",
387
- "HTMLTableRowElement",
388
- "HTMLTableSectionElement",
389
- "HTMLTemplateElement",
390
- "HTMLTextAreaElement",
391
- "HTMLUnknownElement",
392
- "HTMLFrameElement",
393
- "HTMLFrameSetElement",
394
- "HTMLIFrameElement",
395
- "HTMLEmbedElement",
396
- "HTMLObjectElement",
397
- "HTMLParamElement",
398
- "HTMLVideoElement",
399
- "HTMLAudioElement",
400
- "HTMLTrackElement",
401
- "SVGElement",
402
- "SVGGraphicsElement",
403
- "SVGSVGElement",
404
- "SVGTitleElement",
405
- "SVGAnimatedString",
406
- "SVGNumber",
407
- "SVGStringList",
408
- "Event",
409
- "CloseEvent",
410
- "CustomEvent",
411
- "MessageEvent",
412
- "ErrorEvent",
413
- "HashChangeEvent",
414
- "PopStateEvent",
415
- "StorageEvent",
416
- "ProgressEvent",
417
- "PageTransitionEvent",
418
- "UIEvent",
419
- "FocusEvent",
420
- "InputEvent",
421
- "MouseEvent",
422
- "KeyboardEvent",
423
- "TouchEvent",
424
- "CompositionEvent",
425
- "WheelEvent",
426
- "BarProp",
427
- "External",
428
- "Location",
429
- "History",
430
- "Screen",
431
- "Performance",
432
- "Navigator",
433
- "PluginArray",
434
- "MimeTypeArray",
435
- "Plugin",
436
- "MimeType",
437
- "FileReader",
438
- "Blob",
439
- "File",
440
- "FileList",
441
- "ValidityState",
442
- "DOMParser",
443
- "XMLSerializer",
444
- "FormData",
445
- "XMLHttpRequestEventTarget",
446
- "XMLHttpRequestUpload",
447
- "XMLHttpRequest",
448
- "WebSocket",
449
- "NodeFilter",
450
- "NodeIterator",
451
- "TreeWalker",
452
- "AbstractRange",
453
- "Range",
454
- "StaticRange",
455
- "Selection",
456
- "Storage",
457
- "CustomElementRegistry",
458
- "ShadowRoot",
459
- "MutationObserver",
460
- "MutationRecord",
461
- "Headers",
462
- "AbortController",
463
- "AbortSignal",
464
- "Image",
465
- "Audio",
466
- "Option"
467
- ];
468
- const OTHER_KEYS = [
469
- "addEventListener",
470
- "alert",
471
- "atob",
472
- "blur",
473
- "btoa",
474
- "cancelAnimationFrame",
475
- "close",
476
- "confirm",
477
- "createPopup",
478
- "dispatchEvent",
479
- "document",
480
- "focus",
481
- "frames",
482
- "getComputedStyle",
483
- "history",
484
- "innerHeight",
485
- "innerWidth",
486
- "length",
487
- "location",
488
- "matchMedia",
489
- "moveBy",
490
- "moveTo",
491
- "name",
492
- "navigator",
493
- "open",
494
- "outerHeight",
495
- "outerWidth",
496
- "pageXOffset",
497
- "pageYOffset",
498
- "parent",
499
- "postMessage",
500
- "print",
501
- "prompt",
502
- "removeEventListener",
503
- "requestAnimationFrame",
504
- "resizeBy",
505
- "resizeTo",
506
- "screen",
507
- "screenLeft",
508
- "screenTop",
509
- "screenX",
510
- "screenY",
511
- "scroll",
512
- "scrollBy",
513
- "scrollLeft",
514
- "scrollTo",
515
- "scrollTop",
516
- "scrollX",
517
- "scrollY",
518
- "self",
519
- "stop",
520
- "top",
521
- "Window",
522
- "window"
523
- ];
524
- const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
525
-
526
- const allowRewrite = [
527
- "Event",
528
- "EventTarget",
529
- "MessageEvent",
530
- "ArrayBuffer"
531
- ];
532
- const skipKeys = [
533
- "window",
534
- "self",
535
- "top",
536
- "parent"
537
- ];
538
- function getWindowKeys(global, win) {
539
- const keys = new Set(KEYS.concat(Object.getOwnPropertyNames(win)).filter((k) => {
540
- if (skipKeys.includes(k))
541
- return false;
542
- if (k in global)
543
- return allowRewrite.includes(k);
544
- return true;
545
- }));
546
- return keys;
547
- }
548
- function isClassLikeName(name) {
549
- return name[0] === name[0].toUpperCase();
550
- }
551
- function populateGlobal(global, win, options = {}) {
552
- const { bindFunctions = false } = options;
553
- const keys = getWindowKeys(global, win);
554
- const originals = new Map(allowRewrite.filter((key) => key in global).map((key) => [key, global[key]]));
555
- const overrideObject = /* @__PURE__ */ new Map();
556
- for (const key of keys) {
557
- const boundFunction = bindFunctions && typeof win[key] === "function" && !isClassLikeName(key) && win[key].bind(win);
558
- Object.defineProperty(global, key, {
559
- get() {
560
- if (overrideObject.has(key))
561
- return overrideObject.get(key);
562
- if (boundFunction)
563
- return boundFunction;
564
- return win[key];
565
- },
566
- set(v) {
567
- overrideObject.set(key, v);
568
- },
569
- configurable: true
570
- });
571
- }
572
- global.window = global;
573
- global.self = global;
574
- global.top = global;
575
- global.parent = global;
576
- if (global.global)
577
- global.global = global;
578
- skipKeys.forEach((k) => keys.add(k));
579
- return {
580
- keys,
581
- skipKeys,
582
- originals
583
- };
584
- }
585
-
586
- var jsdom = {
587
- name: "jsdom",
588
- async setup(global, { jsdom = {} }) {
589
- const {
590
- CookieJar,
591
- JSDOM,
592
- ResourceLoader,
593
- VirtualConsole
594
- } = await importModule("jsdom");
595
- const {
596
- html = "<!DOCTYPE html>",
597
- userAgent,
598
- url = "http://localhost:3000",
599
- contentType = "text/html",
600
- pretendToBeVisual = true,
601
- includeNodeLocations = false,
602
- runScripts = "dangerously",
603
- resources,
604
- console = false,
605
- cookieJar = false,
606
- ...restOptions
607
- } = jsdom;
608
- const dom = new JSDOM(html, {
609
- pretendToBeVisual,
610
- resources: resources ?? (userAgent ? new ResourceLoader({ userAgent }) : void 0),
611
- runScripts,
612
- url,
613
- virtualConsole: console && global.console ? new VirtualConsole().sendTo(global.console) : void 0,
614
- cookieJar: cookieJar ? new CookieJar() : void 0,
615
- includeNodeLocations,
616
- contentType,
617
- userAgent,
618
- ...restOptions
619
- });
620
- const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true });
621
- return {
622
- teardown(global2) {
623
- keys.forEach((key) => delete global2[key]);
624
- originals.forEach((v, k) => global2[k] = v);
625
- }
626
- };
627
- }
628
- };
629
-
630
- var happy = {
631
- name: "happy-dom",
632
- async setup(global) {
633
- const { Window, GlobalWindow } = await importModule("happy-dom");
634
- const win = new (GlobalWindow || Window)();
635
- const { keys, originals } = populateGlobal(global, win, { bindFunctions: true });
636
- return {
637
- teardown(global2) {
638
- win.happyDOM.cancelAsync();
639
- keys.forEach((key) => delete global2[key]);
640
- originals.forEach((v, k) => global2[k] = v);
641
- }
642
- };
643
- }
644
- };
645
-
646
- var edge = {
647
- name: "edge-runtime",
648
- async setup(global) {
649
- const { EdgeVM } = await importModule("@edge-runtime/vm");
650
- const vm = new EdgeVM({
651
- extend: (context) => {
652
- context.global = context;
653
- context.Buffer = Buffer;
654
- return context;
655
- }
656
- });
657
- const { keys, originals } = populateGlobal(global, vm.context, { bindFunctions: true });
658
- return {
659
- teardown(global2) {
660
- keys.forEach((key) => delete global2[key]);
661
- originals.forEach((v, k) => global2[k] = v);
662
- }
663
- };
664
- }
665
- };
666
-
667
- const environments = {
668
- node,
669
- jsdom,
670
- "happy-dom": happy,
671
- "edge-runtime": edge
672
- };
673
- const envs = Object.keys(environments);
674
- const envPackageNames = {
675
- "jsdom": "jsdom",
676
- "happy-dom": "happy-dom",
677
- "edge-runtime": "@edge-runtime/vm"
678
- };
679
-
680
- export { cleanCoverage as a, reportCoverage as b, configDefaults as c, envPackageNames as d, environments as e, envs as f, pLimit as p, resolveC8Options as r, takeCoverage as t };