vitest 4.0.2 → 4.0.3

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.
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
619
619
 
620
620
  const cac = (name = "") => new CAC(name);
621
621
 
622
- var version = "4.0.2";
622
+ var version = "4.0.3";
623
623
 
624
624
  const apiConfig = (port) => ({
625
625
  port: {
@@ -1294,7 +1294,7 @@ function normalizeCliOptions(cliFilters, argv) {
1294
1294
  }
1295
1295
  async function start(mode, cliFilters, options) {
1296
1296
  try {
1297
- const { startVitest } = await import('./cli-api.B5AMMsRQ.js').then(function (n) { return n.p; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
1297
+ const { startVitest } = await import('./cli-api.D24RdiHp.js').then(function (n) { return n.p; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
1298
1298
  if (!ctx.shouldKeepServer()) await ctx.exit();
1299
1299
  } catch (e) {
1300
1300
  const { errorBanner } = await import('./index.CcRZ6fUh.js').then(function (n) { return n.u; });
@@ -1304,12 +1304,12 @@ async function start(mode, cliFilters, options) {
1304
1304
  }
1305
1305
  async function init(project) {
1306
1306
  if (project !== "browser") console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project.")), process.exit(1);
1307
- const { create } = await import('./creator.DucAaYBz.js');
1307
+ const { create } = await import('./creator.cqqifzG7.js');
1308
1308
  await create();
1309
1309
  }
1310
1310
  async function collect(mode, cliFilters, options) {
1311
1311
  try {
1312
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.B5AMMsRQ.js').then(function (n) { return n.p; }), ctx = await prepareVitest(mode, {
1312
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.D24RdiHp.js').then(function (n) { return n.p; }), ctx = await prepareVitest(mode, {
1313
1313
  ...normalizeCliOptions(cliFilters, options),
1314
1314
  watch: false,
1315
1315
  run: true
@@ -11,7 +11,7 @@ import * as nodeos from 'node:os';
11
11
  import nodeos__default, { tmpdir } from 'node:os';
12
12
  import { generateHash as generateHash$1, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, hasFailed, generateFileHash, limitConcurrency, createFileTask as createFileTask$1, getTasks, isTestCase } from '@vitest/runner/utils';
13
13
  import { SnapshotManager } from '@vitest/snapshot/manager';
14
- import { v as version$1 } from './cac.BbKNPQvp.js';
14
+ import { v as version$1 } from './cac.D3tBgDur.js';
15
15
  import { c as createBirpc } from './index.Bgo3tNWt.js';
16
16
  import { p as parse, d as stringify, e as TraceMap, o as originalPositionFor, h as ancestor, i as printError, f as formatProjectName, w as withLabel, j as errorBanner, k as divider, l as Typechecker, m as generateCodeFrame, n as createDefinesScript, R as ReportersMap, B as BlobReporter, r as readBlobs, q as convertTasksToEvents, H as HangingProcessReporter } from './index.CcRZ6fUh.js';
17
17
  import require$$0$3 from 'events';
@@ -28,7 +28,7 @@ import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
28
28
  import crypto, { createHash } from 'node:crypto';
29
29
  import { rootDir, distDir } from '../path.js';
30
30
  import createDebug from 'debug';
31
- import { h as hash, R as RandomSequencer, i as isPackageExists, c as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, a as resolveApiServerConfig } from './coverage.FU3w4IrQ.js';
31
+ import { h as hash, R as RandomSequencer, i as isPackageExists, c as isBrowserEnabled, r as resolveConfig, g as getCoverageProvider, a as resolveApiServerConfig } from './coverage.BJHGXm3x.js';
32
32
  import { readFile, writeFile, rename, stat, unlink, rm, mkdir, copyFile } from 'node:fs/promises';
33
33
  import { builtinModules, createRequire, isBuiltin } from 'node:module';
34
34
  import { VitestModuleEvaluator } from '#module-evaluator';
@@ -2622,7 +2622,16 @@ function resolveConfig$1(vitest, options, viteConfig) {
2622
2622
  const reportersFromCLI = resolved.reporter, cliReporters = toArray(reportersFromCLI || []).map((reporter) => {
2623
2623
  return /^\.\.?\//.test(reporter) ? resolve(process.cwd(), reporter) : reporter;
2624
2624
  });
2625
- if (cliReporters.length) resolved.reporters = Array.from(new Set(toArray(cliReporters))).filter(Boolean).map((reporter) => [reporter, {}]);
2625
+ if (cliReporters.length) {
2626
+ // When CLI reporters are specified, preserve options from config file
2627
+ const configReportersMap = /* @__PURE__ */ new Map();
2628
+ // Build a map of reporter names to their options from the config
2629
+ for (const reporter of resolved.reporters) if (Array.isArray(reporter)) {
2630
+ const [reporterName, reporterOptions] = reporter;
2631
+ if (typeof reporterName === "string") configReportersMap.set(reporterName, reporterOptions);
2632
+ }
2633
+ resolved.reporters = Array.from(new Set(toArray(cliReporters))).filter(Boolean).map((reporter) => [reporter, configReportersMap.get(reporter) || {}]);
2634
+ }
2626
2635
  }
2627
2636
  if (!resolved.reporters.length) {
2628
2637
  // also enable github-actions reporter as a default
@@ -36,7 +36,7 @@ export default function HelloWorld({ name }: { name: string }) {
36
36
  test: `
37
37
  import { expect, test } from 'vitest'
38
38
  import { render } from '@testing-library/jsx'
39
- import HelloWorld from './HelloWorld.jsx'
39
+ import HelloWorld from './HelloWorld.<EXT>x'
40
40
 
41
41
  test('renders name', async () => {
42
42
  const { getByText } = await render(<HelloWorld name="Vitest" />)
@@ -291,6 +291,7 @@ async function generateExampleFiles(framework, lang) {
291
291
  const isJSX = fileName.endsWith(".jsx");
292
292
  if (isJSX && lang === "ts") fileName = fileName.replace(".jsx", ".tsx");
293
293
  else if (fileName.endsWith(".js") && lang === "ts") fileName = fileName.replace(".js", ".ts");
294
+ example.test = example.test.replace("<EXT>", lang);
294
295
  const filePath = resolve(folder, fileName), testPath = resolve(folder, `HelloWorld.test.${isJSX ? `${lang}x` : lang}`);
295
296
  return writeFileSync(filePath, fileContent.trimStart(), "utf-8"), writeFileSync(testPath, example.test.trimStart(), "utf-8"), testPath;
296
297
  }
@@ -349,7 +349,12 @@ var happy = {
349
349
  "Request",
350
350
  "Response",
351
351
  "MessagePort",
352
- "fetch"
352
+ "fetch",
353
+ "Headers",
354
+ "AbortController",
355
+ "AbortSignal",
356
+ "URL",
357
+ "URLSearchParams"
353
358
  ]
354
359
  });
355
360
  return { async teardown(global) {
@@ -1,5 +1,5 @@
1
1
  import v8 from 'node:v8';
2
- import { i as init } from './init.94FWN9pW.js';
2
+ import { i as init } from './init.DvvF4rpe.js';
3
3
 
4
4
  if (!process.send) throw new Error("Expected worker to be run in node:child_process");
5
5
  // Store globals in case tests overwrite them
@@ -1,5 +1,5 @@
1
1
  import { isMainThread, parentPort } from 'node:worker_threads';
2
- import { i as init } from './init.94FWN9pW.js';
2
+ import { i as init } from './init.DvvF4rpe.js';
3
3
 
4
4
  if (isMainThread || !parentPort) throw new Error("Expected worker to be run in node:worker_threads");
5
5
  function workerInit(options) {
@@ -6,7 +6,7 @@ import { pathToFileURL } from 'node:url';
6
6
  import { resolve } from 'pathe';
7
7
  import { ModuleRunner } from 'vite/module-runner';
8
8
  import { b as VitestTransport } from './startModuleRunner.iF1E9Bt4.js';
9
- import { e as environments } from './index.CbWINfS7.js';
9
+ import { e as environments } from './index.DON9WL-E.js';
10
10
  import { s as setupInspect } from './inspector.DLZxSeU3.js';
11
11
  import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
12
12
  import { c as createRuntimeRpc, a as rpcDone } from './rpc.cD77ENhU.js';
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createCLI } from './chunks/cac.BbKNPQvp.js';
1
+ import { c as createCLI } from './chunks/cac.D3tBgDur.js';
2
2
  import '@vitest/utils/helpers';
3
3
  import 'events';
4
4
  import 'pathe';
package/dist/coverage.js CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BaseCoverageProvider } from './chunks/coverage.FU3w4IrQ.js';
1
+ export { B as BaseCoverageProvider } from './chunks/coverage.BJHGXm3x.js';
2
2
  import 'node:fs';
3
3
  import 'node:path';
4
4
  import '@vitest/utils/helpers';
@@ -1,2 +1,2 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.CbWINfS7.js';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.DON9WL-E.js';
2
2
  import 'node:console';
package/dist/node.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as vite from 'vite';
2
2
  import { resolveConfig as resolveConfig$1, mergeConfig } from 'vite';
3
3
  export { esbuildVersion, isCSSRequest, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
4
- import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.B5AMMsRQ.js';
5
- export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, o as createDebugger, d as createMethodsRPC, n as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.B5AMMsRQ.js';
6
- export { p as parseCLI } from './chunks/cac.BbKNPQvp.js';
7
- import { r as resolveConfig$2 } from './chunks/coverage.FU3w4IrQ.js';
8
- export { b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.FU3w4IrQ.js';
4
+ import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.D24RdiHp.js';
5
+ export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, o as createDebugger, d as createMethodsRPC, n as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.D24RdiHp.js';
6
+ export { p as parseCLI } from './chunks/cac.D3tBgDur.js';
7
+ import { r as resolveConfig$2 } from './chunks/coverage.BJHGXm3x.js';
8
+ export { b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.BJHGXm3x.js';
9
9
  import { slash, deepClone } from '@vitest/utils/helpers';
10
10
  import { a as any } from './chunks/index.Dc3xnDvT.js';
11
11
  import { resolve } from 'pathe';
package/dist/worker.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { r as runBaseTests } from './chunks/base.CVAgx931.js';
2
- export { i as init } from './chunks/init.94FWN9pW.js';
2
+ export { i as init } from './chunks/init.DvvF4rpe.js';
3
3
  import 'node:vm';
4
4
  import '@vitest/spy';
5
5
  import './chunks/evaluatedModules.Dg1zASAC.js';
@@ -42,5 +42,5 @@ import 'node:util';
42
42
  import '@vitest/utils/constants';
43
43
  import './chunks/index.RwjEGCQ0.js';
44
44
  import 'expect-type';
45
- import './chunks/index.CbWINfS7.js';
45
+ import './chunks/index.DON9WL-E.js';
46
46
  import 'node:console';
@@ -1,5 +1,5 @@
1
1
  import { r as runBaseTests } from '../chunks/base.CVAgx931.js';
2
- import { w as workerInit } from '../chunks/init-forks.WglB-sfY.js';
2
+ import { w as workerInit } from '../chunks/init-forks.BtwT3q9G.js';
3
3
  import 'node:vm';
4
4
  import '@vitest/spy';
5
5
  import '../chunks/evaluatedModules.Dg1zASAC.js';
@@ -43,8 +43,8 @@ import '@vitest/utils/constants';
43
43
  import '../chunks/index.RwjEGCQ0.js';
44
44
  import 'expect-type';
45
45
  import 'node:v8';
46
- import '../chunks/init.94FWN9pW.js';
47
- import '../chunks/index.CbWINfS7.js';
46
+ import '../chunks/init.DvvF4rpe.js';
47
+ import '../chunks/index.DON9WL-E.js';
48
48
  import 'node:console';
49
49
 
50
50
  workerInit({ runTests: runBaseTests });
@@ -1,5 +1,5 @@
1
1
  import { r as runBaseTests } from '../chunks/base.CVAgx931.js';
2
- import { w as workerInit } from '../chunks/init-threads.Czek6eA5.js';
2
+ import { w as workerInit } from '../chunks/init-threads.BEmFEaEY.js';
3
3
  import 'node:vm';
4
4
  import '@vitest/spy';
5
5
  import '../chunks/evaluatedModules.Dg1zASAC.js';
@@ -43,8 +43,8 @@ import '@vitest/utils/constants';
43
43
  import '../chunks/index.RwjEGCQ0.js';
44
44
  import 'expect-type';
45
45
  import 'node:worker_threads';
46
- import '../chunks/init.94FWN9pW.js';
47
- import '../chunks/index.CbWINfS7.js';
46
+ import '../chunks/init.DvvF4rpe.js';
47
+ import '../chunks/index.DON9WL-E.js';
48
48
  import 'node:console';
49
49
 
50
50
  workerInit({ runTests: runBaseTests });
@@ -1,7 +1,7 @@
1
- import { w as workerInit } from '../chunks/init-forks.WglB-sfY.js';
1
+ import { w as workerInit } from '../chunks/init-forks.BtwT3q9G.js';
2
2
  import { r as runVmTests } from '../chunks/vm.CuMWYx_F.js';
3
3
  import 'node:v8';
4
- import '../chunks/init.94FWN9pW.js';
4
+ import '../chunks/init.DvvF4rpe.js';
5
5
  import '@vitest/utils/error';
6
6
  import '@vitest/utils/source-map';
7
7
  import 'node:fs';
@@ -17,7 +17,7 @@ import '@vitest/utils/serialize';
17
17
  import '../module-evaluator.js';
18
18
  import 'node:vm';
19
19
  import '@vitest/mocker';
20
- import '../chunks/index.CbWINfS7.js';
20
+ import '../chunks/index.DON9WL-E.js';
21
21
  import 'node:console';
22
22
  import '../chunks/inspector.DLZxSeU3.js';
23
23
  import '../chunks/evaluatedModules.Dg1zASAC.js';
@@ -1,7 +1,7 @@
1
- import { w as workerInit } from '../chunks/init-threads.Czek6eA5.js';
1
+ import { w as workerInit } from '../chunks/init-threads.BEmFEaEY.js';
2
2
  import { r as runVmTests } from '../chunks/vm.CuMWYx_F.js';
3
3
  import 'node:worker_threads';
4
- import '../chunks/init.94FWN9pW.js';
4
+ import '../chunks/init.DvvF4rpe.js';
5
5
  import '@vitest/utils/error';
6
6
  import '@vitest/utils/source-map';
7
7
  import 'node:fs';
@@ -17,7 +17,7 @@ import '@vitest/utils/serialize';
17
17
  import '../module-evaluator.js';
18
18
  import 'node:vm';
19
19
  import '@vitest/mocker';
20
- import '../chunks/index.CbWINfS7.js';
20
+ import '../chunks/index.DON9WL-E.js';
21
21
  import 'node:console';
22
22
  import '../chunks/inspector.DLZxSeU3.js';
23
23
  import '../chunks/evaluatedModules.Dg1zASAC.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "4.0.2",
4
+ "version": "4.0.3",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -134,10 +134,10 @@
134
134
  "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
135
135
  "happy-dom": "*",
136
136
  "jsdom": "*",
137
- "@vitest/browser-preview": "4.0.2",
138
- "@vitest/browser-playwright": "4.0.2",
139
- "@vitest/ui": "4.0.2",
140
- "@vitest/browser-webdriverio": "4.0.2"
137
+ "@vitest/browser-playwright": "4.0.3",
138
+ "@vitest/browser-preview": "4.0.3",
139
+ "@vitest/browser-webdriverio": "4.0.3",
140
+ "@vitest/ui": "4.0.3"
141
141
  },
142
142
  "peerDependenciesMeta": {
143
143
  "@edge-runtime/vm": {
@@ -182,13 +182,13 @@
182
182
  "tinyrainbow": "^3.0.3",
183
183
  "vite": "^6.0.0 || ^7.0.0",
184
184
  "why-is-node-running": "^2.3.0",
185
- "@vitest/mocker": "4.0.2",
186
- "@vitest/runner": "4.0.2",
187
- "@vitest/expect": "4.0.2",
188
- "@vitest/pretty-format": "4.0.2",
189
- "@vitest/spy": "4.0.2",
190
- "@vitest/utils": "4.0.2",
191
- "@vitest/snapshot": "4.0.2"
185
+ "@vitest/expect": "4.0.3",
186
+ "@vitest/mocker": "4.0.3",
187
+ "@vitest/pretty-format": "4.0.3",
188
+ "@vitest/runner": "4.0.3",
189
+ "@vitest/spy": "4.0.3",
190
+ "@vitest/utils": "4.0.3",
191
+ "@vitest/snapshot": "4.0.3"
192
192
  },
193
193
  "devDependencies": {
194
194
  "@antfu/install-pkg": "^1.1.0",