vitest 4.0.0-beta.6 → 4.0.0-beta.7

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 (31) hide show
  1. package/dist/browser.d.ts +3 -3
  2. package/dist/chunks/{browser.d.Cawq_X_N.d.ts → browser.d.DOMmqJQx.d.ts} +1 -1
  3. package/dist/chunks/{cac.WE-urWw5.js → cac.Dsn7ixFt.js} +7 -6
  4. package/dist/chunks/{cli-api.CZz3evYC.js → cli-api.DfGJyldU.js} +341 -38
  5. package/dist/chunks/{config.d.CKNVOKm0.d.ts → config.d._GBBbReY.d.ts} +1 -0
  6. package/dist/chunks/{coverage.BPRS6xgn.js → coverage.Dvxug1RM.js} +1 -1
  7. package/dist/chunks/{index.VNI-1z5c.js → index.C3EbxYwt.js} +8 -3
  8. package/dist/chunks/{index.7w0eqmYM.js → index.D2B6d2vv.js} +1 -1
  9. package/dist/chunks/{index.BG0gqZH-.js → index.DfviD7lX.js} +16 -8
  10. package/dist/chunks/{moduleRunner.d.8kKUsuDg.d.ts → moduleRunner.d.CX4DuqOx.d.ts} +1 -1
  11. package/dist/chunks/{plugin.d.DuiQJfUL.d.ts → plugin.d.vcD4xbMS.d.ts} +1 -1
  12. package/dist/chunks/{reporters.d.CqR9-CDJ.d.ts → reporters.d.BC86JJdB.d.ts} +785 -727
  13. package/dist/chunks/{typechecker.Cd1wvxUM.js → typechecker.DSo_maXz.js} +1 -1
  14. package/dist/chunks/{worker.d.Db-UVmXc.d.ts → worker.d.BKu8cnnX.d.ts} +1 -1
  15. package/dist/chunks/{worker.d.D9QWnzAe.d.ts → worker.d.DYlqbejz.d.ts} +1 -1
  16. package/dist/cli.js +3 -3
  17. package/dist/config.d.ts +6 -6
  18. package/dist/coverage.d.ts +4 -4
  19. package/dist/coverage.js +2 -2
  20. package/dist/environments.js +1 -1
  21. package/dist/index.d.ts +6 -6
  22. package/dist/module-evaluator.d.ts +3 -3
  23. package/dist/node.d.ts +11 -9
  24. package/dist/node.js +11 -16
  25. package/dist/reporters.d.ts +4 -4
  26. package/dist/reporters.js +3 -3
  27. package/dist/runners.d.ts +1 -1
  28. package/dist/worker.js +1 -1
  29. package/dist/workers.d.ts +3 -3
  30. package/dist/workers.js +1 -1
  31. package/package.json +10 -10
@@ -1,11 +1,11 @@
1
1
  import { existsSync, readFileSync, promises } from 'node:fs';
2
2
  import { mkdir, writeFile, readdir, stat, readFile } from 'node:fs/promises';
3
3
  import { resolve, dirname, isAbsolute, relative, basename, normalize } from 'pathe';
4
- import { g as getOutputFile, h as hasFailedSnapshot, T as TypeCheckError } from './typechecker.Cd1wvxUM.js';
4
+ import { g as getOutputFile, h as hasFailedSnapshot, T as TypeCheckError } from './typechecker.DSo_maXz.js';
5
5
  import { performance as performance$1 } from 'node:perf_hooks';
6
6
  import { getTestName, getFullName, hasFailed, getTests, getSuites, getTasks } from '@vitest/runner/utils';
7
7
  import { slash, toArray, isPrimitive, inspect, positionToOffset, lineSplitRE } from '@vitest/utils';
8
- import { parseStacktrace, parseErrorStacktrace } from '@vitest/utils/source-map';
8
+ import { parseStacktrace, parseErrorStacktrace, defaultStackIgnorePatterns } from '@vitest/utils/source-map';
9
9
  import c from 'tinyrainbow';
10
10
  import { i as isTTY } from './env.D4Lgay0q.js';
11
11
  import { stripVTControlCharacters } from 'node:util';
@@ -1124,7 +1124,12 @@ function printError(error, ctx, logger, options) {
1124
1124
  printProperties: options.verbose,
1125
1125
  parseErrorStacktrace(error) {
1126
1126
  // node.js stack trace already has correct source map locations
1127
- return options.task?.file.pool === "browser" && project.browser ? project.browser.parseErrorStacktrace(error, { ignoreStackEntries: options.fullStack ? [] : void 0 }) : parseErrorStacktrace(error, {
1127
+ return error.stacks ? options.fullStack ? error.stacks : error.stacks.filter((stack) => {
1128
+ return !defaultStackIgnorePatterns.some((p) => stack.file.match(p));
1129
+ }) : options.task?.file.pool === "browser" && project.browser ? project.browser.parseErrorStacktrace(error, {
1130
+ frameFilter: project.config.onStackTrace,
1131
+ ignoreStackEntries: options.fullStack ? [] : void 0
1132
+ }) : parseErrorStacktrace(error, {
1128
1133
  frameFilter: project.config.onStackTrace,
1129
1134
  ignoreStackEntries: options.fullStack ? [] : void 0
1130
1135
  });
@@ -2,7 +2,7 @@ import fs from 'node:fs';
2
2
  import { getTasks, getFullName, getTests } from '@vitest/runner/utils';
3
3
  import * as pathe from 'pathe';
4
4
  import c from 'tinyrainbow';
5
- import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.VNI-1z5c.js';
5
+ import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.C3EbxYwt.js';
6
6
  import { stripVTControlCharacters } from 'node:util';
7
7
  import { notNullish } from '@vitest/utils';
8
8
 
@@ -3,8 +3,6 @@ import { Console } from 'node:console';
3
3
  // SEE https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/interfaces.js
4
4
  const LIVING_KEYS = [
5
5
  "DOMException",
6
- "URL",
7
- "URLSearchParams",
8
6
  "EventTarget",
9
7
  "NamedNodeMap",
10
8
  "Node",
@@ -161,9 +159,6 @@ const LIVING_KEYS = [
161
159
  "ShadowRoot",
162
160
  "MutationObserver",
163
161
  "MutationRecord",
164
- "Headers",
165
- "AbortController",
166
- "AbortSignal",
167
162
  "Uint8Array",
168
163
  "Uint16Array",
169
164
  "Uint32Array",
@@ -402,9 +397,6 @@ var jsdom = {
402
397
  // https://nodejs.org/dist/latest/docs/api/globals.html
403
398
  const globalNames = [
404
399
  "structuredClone",
405
- "fetch",
406
- "Request",
407
- "Response",
408
400
  "BroadcastChannel",
409
401
  "MessageChannel",
410
402
  "MessagePort",
@@ -415,6 +407,22 @@ var jsdom = {
415
407
  const value = globalThis[name];
416
408
  if (typeof value !== "undefined" && typeof dom.window[name] === "undefined") dom.window[name] = value;
417
409
  }
410
+ // since we are providing Node.js's Fetch API,
411
+ // we also should override other APIs they use
412
+ const overrideGlobals = [
413
+ "fetch",
414
+ "Request",
415
+ "Response",
416
+ "Headers",
417
+ "AbortController",
418
+ "AbortSignal",
419
+ "URL",
420
+ "URLSearchParams"
421
+ ];
422
+ for (const name of overrideGlobals) {
423
+ const value = globalThis[name];
424
+ if (typeof value !== "undefined") dom.window[name] = value;
425
+ }
418
426
  return {
419
427
  getVmContext() {
420
428
  return dom.getInternalVMContext();
@@ -1,6 +1,6 @@
1
1
  import vm from 'node:vm';
2
2
  import { ModuleEvaluator, ModuleRunnerImportMeta, ModuleRunnerContext, EvaluatedModuleNode, FetchFunction, ModuleRunner, EvaluatedModules } from 'vite/module-runner';
3
- import { R as RuntimeRPC, W as WorkerGlobalState } from './worker.d.D9QWnzAe.js';
3
+ import { R as RuntimeRPC, W as WorkerGlobalState } from './worker.d.DYlqbejz.js';
4
4
  import { R as ResolveFunctionResult } from './environment.d.2fYMoz3o.js';
5
5
  import { MockedModule, MockedModuleType } from '@vitest/mocker';
6
6
  import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './mocker.d.BE_2ls6u.js';
@@ -1,4 +1,4 @@
1
- import { V as Vitest, T as TestProject, a as TestProjectConfiguration } from './reporters.d.CqR9-CDJ.js';
1
+ import { V as Vitest, T as TestProject, a as TestProjectConfiguration } from './reporters.d.BC86JJdB.js';
2
2
 
3
3
  interface VitestPluginContext {
4
4
  vitest: Vitest;