vitest 0.34.2 → 0.34.4

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 (38) hide show
  1. package/dist/browser.d.ts +3 -3
  2. package/dist/browser.js +1 -1
  3. package/dist/child.js +2 -2
  4. package/dist/{chunk-api-setup.cc5282f7.js → chunk-api-setup.d65b007d.js} +4 -4
  5. package/dist/{chunk-install-pkg.7e19b3a0.js → chunk-install-pkg.b2bdbadc.js} +4 -3
  6. package/dist/{chunk-integrations-globals.522ae1ae.js → chunk-integrations-globals.09bbbed7.js} +3 -3
  7. package/dist/cli.js +9 -8
  8. package/dist/config.cjs +3 -1
  9. package/dist/config.d.ts +3 -3
  10. package/dist/config.js +3 -1
  11. package/dist/coverage.d.ts +3 -3
  12. package/dist/entry-vm.js +3 -3
  13. package/dist/entry.js +6 -3
  14. package/dist/environments.d.ts +3 -3
  15. package/dist/environments.js +1 -1
  16. package/dist/execute.d.ts +3 -3
  17. package/dist/execute.js +1 -1
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.js +4 -4
  20. package/dist/loader.js +1 -1
  21. package/dist/node.d.ts +4 -4
  22. package/dist/node.js +4 -3
  23. package/dist/{types-63abf2e0.d.ts → reporters-cb94c88b.d.ts} +18 -15
  24. package/dist/reporters.d.ts +16 -0
  25. package/dist/reporters.js +16 -0
  26. package/dist/runners.d.ts +3 -3
  27. package/dist/runners.js +2 -2
  28. package/dist/{vendor-environments.37f266a9.js → vendor-environments.c9c96bf7.js} +16 -4
  29. package/dist/{vendor-execute.4fc8203a.js → vendor-execute.a63e187f.js} +8 -6
  30. package/dist/{vendor-index.087d1af7.js → vendor-index.29282562.js} +1 -1
  31. package/dist/{vendor-index.b5efbd68.js → vendor-index.e951dd92.js} +1 -1
  32. package/dist/{vendor-node.7b1bd3c5.js → vendor-node.b14cb9ad.js} +156 -2669
  33. package/dist/vendor-reporters.f6975b8d.js +2584 -0
  34. package/dist/{vendor-vi.f8055ff2.js → vendor-vi.befc11a6.js} +24 -23
  35. package/dist/vm.js +2 -2
  36. package/dist/worker.js +2 -2
  37. package/package.json +12 -8
  38. package/reporters.d.ts +1 -0
@@ -265,6 +265,15 @@ const LIVING_KEYS = [
265
265
  "Headers",
266
266
  "AbortController",
267
267
  "AbortSignal",
268
+ "Uint8Array",
269
+ "Uint16Array",
270
+ "Uint32Array",
271
+ "Uint8ClampedArray",
272
+ "Int8Array",
273
+ "Int16Array",
274
+ "Int32Array",
275
+ "Float32Array",
276
+ "Float64Array",
268
277
  "ArrayBuffer",
269
278
  "DOMRectReadOnly",
270
279
  "DOMRect",
@@ -464,7 +473,6 @@ var jsdom = {
464
473
  );
465
474
  const clearWindowErrors = catchWindowErrors(dom.window);
466
475
  dom.window.Buffer = Buffer;
467
- dom.window.Uint8Array = Uint8Array;
468
476
  if (typeof structuredClone !== "undefined" && !dom.window.structuredClone)
469
477
  dom.window.structuredClone = structuredClone;
470
478
  return {
@@ -535,15 +543,14 @@ var happy = {
535
543
  url: happyDOM.url || "http://localhost:3000"
536
544
  });
537
545
  win.Buffer = Buffer;
538
- win.Uint8Array = Uint8Array;
539
546
  if (typeof structuredClone !== "undefined" && !win.structuredClone)
540
547
  win.structuredClone = structuredClone;
541
548
  return {
542
549
  getVmContext() {
543
550
  return win;
544
551
  },
545
- teardown() {
546
- win.happyDOM.cancelAsync();
552
+ async teardown() {
553
+ await win.happyDOM.cancelAsync();
547
554
  }
548
555
  };
549
556
  },
@@ -551,6 +558,7 @@ var happy = {
551
558
  const { Window, GlobalWindow } = await importModule("happy-dom");
552
559
  const win = new (GlobalWindow || Window)({
553
560
  ...happyDOM,
561
+ console: console && global.console ? global.console : void 0,
554
562
  url: happyDOM.url || "http://localhost:3000"
555
563
  });
556
564
  const { keys, originals } = populateGlobal(global, win, { bindFunctions: true });
@@ -590,6 +598,10 @@ var edge = {
590
598
  extend: (context) => {
591
599
  context.global = context;
592
600
  context.Buffer = Buffer;
601
+ KEYS.forEach((key) => {
602
+ if (key in global)
603
+ context[key] = global[key];
604
+ });
593
605
  return context;
594
606
  }
595
607
  });
@@ -317,11 +317,13 @@ ${c.green(`vi.mock("${mockpath}", async () => {
317
317
  return exports;
318
318
  }
319
319
  if (typeof mock === "function" && !callstack.includes(mockPath) && !callstack.includes(url)) {
320
- callstack.push(mockPath);
321
- const result = await this.callFunctionMock(mockPath, mock);
322
- const indexMock = callstack.indexOf(mockPath);
323
- callstack.splice(indexMock, 1);
324
- return result;
320
+ try {
321
+ callstack.push(mockPath);
322
+ return await this.callFunctionMock(mockPath, mock);
323
+ } finally {
324
+ const indexMock = callstack.indexOf(mockPath);
325
+ callstack.splice(indexMock, 1);
326
+ }
325
327
  }
326
328
  if (typeof mock === "string" && !callstack.includes(mock))
327
329
  return mock;
@@ -736,7 +738,7 @@ class ViteExecutor {
736
738
  return cached;
737
739
  const result = await this.options.transform(fileUrl, "web");
738
740
  if (!result.code)
739
- throw new Error(`[vitest] Failed to transform ${fileUrl}. Does the file exists?`);
741
+ throw new Error(`[vitest] Failed to transform ${fileUrl}. Does the file exist?`);
740
742
  return this.esm.createEsModule(fileUrl, result.code);
741
743
  }
742
744
  createViteClientModule() {
@@ -23,4 +23,4 @@ function removeUndefinedValues(obj) {
23
23
  return obj;
24
24
  }
25
25
 
26
- export { isNode as a, removeUndefinedValues as b, isWindows as c, isRunningInBenchmark as i, relativePath as r };
26
+ export { isWindows as a, isNode as b, relativePath as c, isRunningInBenchmark as i, removeUndefinedValues as r };
@@ -1,5 +1,5 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
- import { e as bench, c as createExpect, d as globalExpect, v as vi, f as vitest } from './vendor-vi.f8055ff2.js';
2
+ import { e as bench, c as createExpect, d as globalExpect, v as vi, f as vitest } from './vendor-vi.befc11a6.js';
3
3
  import { i as isFirstRun, r as runOnce } from './vendor-run-once.3e5ef7d7.js';
4
4
  import * as chai from 'chai';
5
5
  import { assert, should } from 'chai';