vitest 1.0.0-beta.0 → 1.0.0-beta.2

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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.d.ts +2 -2
  3. package/dist/browser.js +2 -2
  4. package/dist/child.js +1 -1
  5. package/dist/{chunk-api-setup.0aeabd21.js → chunk-api-setup.5d9a93c7.js} +3 -0
  6. package/dist/{chunk-install-pkg.991b9ea3.js → chunk-install-pkg.43d58972.js} +17 -14
  7. package/dist/{chunk-integrations-globals.c3c5e678.js → chunk-integrations-globals.9df12d91.js} +2 -3
  8. package/dist/{chunk-node-git.36288174.js → chunk-node-git.2f1df48f.js} +1 -1
  9. package/dist/{chunk-runtime-console.ea222ffb.js → chunk-runtime-console.f3263f87.js} +19 -4
  10. package/dist/cli-wrapper.js +1 -1
  11. package/dist/cli.js +7 -4
  12. package/dist/config.cjs +2 -1
  13. package/dist/config.d.ts +2 -2
  14. package/dist/config.js +2 -1
  15. package/dist/coverage.d.ts +1 -1
  16. package/dist/entry-vm.js +8 -3
  17. package/dist/entry.js +9 -4
  18. package/dist/environments.d.ts +1 -1
  19. package/dist/environments.js +1 -1
  20. package/dist/execute.d.ts +1 -1
  21. package/dist/index.d.ts +5 -4
  22. package/dist/index.js +3 -4
  23. package/dist/node.d.ts +2 -2
  24. package/dist/node.js +8 -5
  25. package/dist/{reporters-7bd09217.d.ts → reporters-d10f25e1.d.ts} +23 -18
  26. package/dist/reporters.d.ts +1 -1
  27. package/dist/reporters.js +6 -1
  28. package/dist/runners.d.ts +1 -1
  29. package/dist/runners.js +1 -2
  30. package/dist/{suite-543d56bd.d.ts → suite-919dd548.d.ts} +1 -1
  31. package/dist/suite.d.ts +2 -2
  32. package/dist/{vendor-environments.e73c5410.js → vendor-environments.094f240c.js} +2 -0
  33. package/dist/{vendor-index.f7fcd5e8.js → vendor-index.68ecee35.js} +1 -1
  34. package/dist/{vendor-index.85fc950a.js → vendor-index.e006069f.js} +4 -4
  35. package/dist/{vendor-node.6fe91553.js → vendor-node.e5a35bfe.js} +83 -46
  36. package/dist/{vendor-reporters.f6975b8d.js → vendor-reporters.2953082e.js} +2 -1
  37. package/dist/vendor-vi.d30b47ae.js +3510 -0
  38. package/dist/vm.js +2 -2
  39. package/dist/worker.js +1 -1
  40. package/package.json +10 -10
  41. package/dist/vendor-vi.7f2b988f.js +0 -3491
@@ -1,4 +1,4 @@
1
- export { at as BaseReporter, al as BasicReporter, ax as BenchmarkBuiltinReporters, aw as BenchmarkReportsMap, av as BuiltinReporters, ak as DefaultReporter, am as DotReporter, as as HangingProcessReporter, aq as JUnitReporter, an as JsonReporter, k as Reporter, au as ReportersMap, ar as TapFlatReporter, ap as TapReporter, ao as VerboseReporter } from './reporters-7bd09217.js';
1
+ export { at as BaseReporter, al as BasicReporter, ax as BenchmarkBuiltinReporters, aw as BenchmarkReportsMap, av as BuiltinReporters, ak as DefaultReporter, am as DotReporter, as as HangingProcessReporter, aq as JUnitReporter, an as JsonReporter, k as Reporter, au as ReportersMap, ar as TapFlatReporter, ap as TapReporter, ao as VerboseReporter } from './reporters-d10f25e1.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/reporters.js CHANGED
@@ -1,4 +1,4 @@
1
- export { f as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, g as DotReporter, H as HangingProcessReporter, h as JUnitReporter, J as JsonReporter, R as ReportersMap, i as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor-reporters.f6975b8d.js';
1
+ export { f as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, g as DotReporter, H as HangingProcessReporter, h as JUnitReporter, J as JsonReporter, R as ReportersMap, i as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor-reporters.2953082e.js';
2
2
  import 'node:perf_hooks';
3
3
  import 'picocolors';
4
4
  import './vendor-index.29282562.js';
@@ -7,6 +7,11 @@ import 'std-env';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import './vendor-global.97e4527c.js';
10
+ import './chunk-runtime-console.f3263f87.js';
11
+ import 'node:stream';
12
+ import 'node:console';
13
+ import 'node:path';
14
+ import './vendor-date.6e993429.js';
10
15
  import './vendor-base.9c08bbd0.js';
11
16
  import './vendor-tasks.f9d75aed.js';
12
17
  import './vendor-_commonjsHelpers.7d1333e8.js';
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
2
- import { R as ResolvedConfig } from './reporters-7bd09217.js';
2
+ import { R as ResolvedConfig } from './reporters-d10f25e1.js';
3
3
  import 'vite';
4
4
  import 'vite-node';
5
5
  import '@vitest/snapshot';
package/dist/runners.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor-vi.7f2b988f.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor-vi.d30b47ae.js';
3
3
  import './vendor-index.29282562.js';
4
4
  import { a as rpc } from './vendor-rpc.cbd8e972.js';
5
5
  import { g as getFullName } from './vendor-tasks.f9d75aed.js';
@@ -14,7 +14,6 @@ import './vendor-_commonjsHelpers.7d1333e8.js';
14
14
  import '@vitest/snapshot';
15
15
  import '@vitest/utils/error';
16
16
  import '@vitest/utils/source-map';
17
- import 'util';
18
17
  import './vendor-date.6e993429.js';
19
18
  import '@vitest/spy';
20
19
  import 'pathe';
@@ -1,6 +1,6 @@
1
1
  import { Custom } from '@vitest/runner';
2
2
  import '@vitest/runner/utils';
3
- import { af as BenchFunction, ag as BenchmarkAPI } from './reporters-7bd09217.js';
3
+ import { af as BenchFunction, ag as BenchmarkAPI } from './reporters-d10f25e1.js';
4
4
  import { Options } from 'tinybench';
5
5
 
6
6
  declare function getBenchOptions(key: Custom): Options;
package/dist/suite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createTaskCollector, getCurrentSuite, getFn, setFn } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
- export { g as getBenchFn, a as getBenchOptions } from './suite-543d56bd.js';
4
- import './reporters-7bd09217.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './suite-919dd548.js';
4
+ import './reporters-d10f25e1.js';
5
5
  import 'vite';
6
6
  import 'vite-node';
7
7
  import '@vitest/snapshot';
@@ -654,6 +654,8 @@ function getEnvPackageName(env) {
654
654
  return null;
655
655
  if (env in envPackageNames)
656
656
  return envPackageNames[env];
657
+ if (env[0] === "." || env[0] === "/")
658
+ return null;
657
659
  return `vitest-environment-${env}`;
658
660
  }
659
661
  const _loaders = /* @__PURE__ */ new Map();
@@ -1,7 +1,7 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
2
  import { b as bench } from './vendor-benchmark.44931cfa.js';
3
3
  import { i as isFirstRun, r as runOnce } from './vendor-run-once.3e5ef7d7.js';
4
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vendor-vi.7f2b988f.js';
4
+ import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vendor-vi.d30b47ae.js';
5
5
  import * as chai from 'chai';
6
6
  import { assert, should } from 'chai';
7
7
 
@@ -11,9 +11,9 @@ import nodeos__default, { constants } from 'node:os';
11
11
  import require$$0 from 'assert';
12
12
  import require$$2 from 'events';
13
13
  import { createWriteStream, createReadStream } from 'node:fs';
14
- import require$$0$3 from 'buffer';
14
+ import require$$0$4 from 'buffer';
15
15
  import require$$0$2 from 'stream';
16
- import require$$2$1 from 'util';
16
+ import require$$0$3 from 'util';
17
17
  import { debuglog } from 'node:util';
18
18
 
19
19
  var signalExit = {exports: {}};
@@ -1802,9 +1802,9 @@ var bufferStream$1 = options => {
1802
1802
  return stream;
1803
1803
  };
1804
1804
 
1805
- const {constants: BufferConstants} = require$$0$3;
1805
+ const {constants: BufferConstants} = require$$0$4;
1806
1806
  const stream = require$$0$2;
1807
- const {promisify} = require$$2$1;
1807
+ const {promisify} = require$$0$3;
1808
1808
  const bufferStream = bufferStream$1;
1809
1809
 
1810
1810
  const streamPipelinePromisified = promisify(stream.pipeline);
@@ -1,4 +1,4 @@
1
- import { resolve, relative, dirname, normalize, basename, join, extname, toNamespacedPath } from 'pathe';
1
+ import { relative, resolve, dirname, normalize, basename, join, extname, toNamespacedPath } from 'pathe';
2
2
  import { loadConfigFromFile, searchForWorkspaceRoot, version as version$2, createServer, mergeConfig } from 'vite';
3
3
  import path$a from 'node:path';
4
4
  import url, { fileURLToPath, pathToFileURL } from 'node:url';
@@ -8,9 +8,9 @@ import { E as EXIT_CODE_RESTART, c as configFiles, d as defaultPort, a as defaul
8
8
  import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './vendor-_commonjsHelpers.7d1333e8.js';
9
9
  import require$$0 from 'os';
10
10
  import f$1 from 'path';
11
- import require$$2 from 'util';
12
- import require$$0$1 from 'stream';
13
- import require$$2$1 from 'events';
11
+ import require$$0$1 from 'util';
12
+ import require$$0$2 from 'stream';
13
+ import require$$2 from 'events';
14
14
  import $ from 'fs';
15
15
  import c from 'picocolors';
16
16
  import { slash as slash$2, normalizeRequestId, cleanUrl } from 'vite-node/utils';
@@ -19,7 +19,7 @@ import { SnapshotManager } from '@vitest/snapshot/manager';
19
19
  import { ViteNodeServer } from 'vite-node/server';
20
20
  import { r as removeUndefinedValues, a as isWindows } from './vendor-index.29282562.js';
21
21
  import { g as getCoverageProvider, C as CoverageProviderMap } from './vendor-coverage.78040316.js';
22
- import { d as distDir, r as rootDir } from './vendor-paths.84fc7a99.js';
22
+ import { r as rootDir, d as distDir } from './vendor-paths.84fc7a99.js';
23
23
  import v8 from 'node:v8';
24
24
  import * as nodeos from 'node:os';
25
25
  import EventEmitter from 'node:events';
@@ -30,9 +30,9 @@ import { MessageChannel } from 'node:worker_threads';
30
30
  import { createDefer, shuffle, inspect, positionToOffset, lineSplitRE, toArray as toArray$1, notNullish } from '@vitest/utils';
31
31
  import { isPackageExists, resolveModule } from 'local-pkg';
32
32
  import { isCI } from 'std-env';
33
- import { R as ReportersMap, B as BenchmarkReportsMap, s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, d as divider, F as F_POINTER, e as cliTruncate } from './vendor-reporters.f6975b8d.js';
33
+ import { R as ReportersMap, B as BenchmarkReportsMap, s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, d as divider, F as F_POINTER, e as cliTruncate } from './vendor-reporters.2953082e.js';
34
34
  import crypto, { createHash } from 'node:crypto';
35
- import { o as onExit, e as execa } from './vendor-index.85fc950a.js';
35
+ import { o as onExit, e as execa } from './vendor-index.e006069f.js';
36
36
  import { TraceMap, generatedPositionFor, parseErrorStacktrace } from '@vitest/utils/source-map';
37
37
  import { writeFile, rm } from 'node:fs/promises';
38
38
  import ue from 'module';
@@ -41,9 +41,9 @@ import { ancestor, simple, findNodeAround } from 'acorn-walk';
41
41
  import { generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks, hasFailed } from '@vitest/runner/utils';
42
42
  import MagicString from 'magic-string';
43
43
  import { stripLiteral } from 'strip-literal';
44
- import { g as getEnvPackageName } from './vendor-environments.e73c5410.js';
44
+ import { g as getEnvPackageName } from './vendor-environments.094f240c.js';
45
45
  import readline from 'node:readline';
46
- import require$$0$2 from 'readline';
46
+ import require$$0$3 from 'readline';
47
47
 
48
48
  function _mergeNamespaces(n, m) {
49
49
  m.forEach(function (e) {
@@ -60,7 +60,7 @@ function _mergeNamespaces(n, m) {
60
60
  return Object.freeze(n);
61
61
  }
62
62
 
63
- var version$1 = "1.0.0-beta.0";
63
+ var version$1 = "1.0.0-beta.2";
64
64
 
65
65
  const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
66
66
  async function ensurePackageInstalled(dependency, root) {
@@ -79,7 +79,7 @@ async function ensurePackageInstalled(dependency, root) {
79
79
  message: c.reset(`Do you want to install ${c.green(dependency)}?`)
80
80
  });
81
81
  if (install) {
82
- await (await import('./chunk-install-pkg.991b9ea3.js')).installPackage(dependency, { dev: true });
82
+ await (await import('./chunk-install-pkg.43d58972.js')).installPackage(dependency, { dev: true });
83
83
  process.stderr.write(c.yellow(`
84
84
  Package ${dependency} installed, re-run the command to start.
85
85
  `));
@@ -1166,7 +1166,7 @@ var toRegexRange_1 = toRegexRange$1;
1166
1166
  * Licensed under the MIT License.
1167
1167
  */
1168
1168
 
1169
- const util$3 = require$$2;
1169
+ const util$3 = require$$0$1;
1170
1170
  const toRegexRange = toRegexRange_1;
1171
1171
 
1172
1172
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
@@ -4198,7 +4198,7 @@ var picomatch_1 = picomatch$2;
4198
4198
 
4199
4199
  var picomatch$1 = picomatch_1;
4200
4200
 
4201
- const util$2 = require$$2;
4201
+ const util$2 = require$$0$1;
4202
4202
  const braces = braces_1;
4203
4203
  const picomatch = picomatch$1;
4204
4204
  const utils$b = utils$f;
@@ -4863,7 +4863,7 @@ var stream$4 = {};
4863
4863
  * Copyright (c) 2014-2020 Teambition
4864
4864
  * Licensed under the MIT license.
4865
4865
  */
4866
- const Stream = require$$0$1;
4866
+ const Stream = require$$0$2;
4867
4867
  const PassThrough = Stream.PassThrough;
4868
4868
  const slice = Array.prototype.slice;
4869
4869
 
@@ -6027,7 +6027,7 @@ let Reader$1 = class Reader {
6027
6027
  reader$1.default = Reader$1;
6028
6028
 
6029
6029
  Object.defineProperty(async$4, "__esModule", { value: true });
6030
- const events_1 = require$$2$1;
6030
+ const events_1 = require$$2;
6031
6031
  const fsScandir$2 = out$2;
6032
6032
  const fastq = queueExports;
6033
6033
  const common$1 = common$3;
@@ -6156,7 +6156,7 @@ function callSuccessCallback(callback, entries) {
6156
6156
  var stream$2 = {};
6157
6157
 
6158
6158
  Object.defineProperty(stream$2, "__esModule", { value: true });
6159
- const stream_1$5 = require$$0$1;
6159
+ const stream_1$5 = require$$0$2;
6160
6160
  const async_1$3 = async$4;
6161
6161
  class StreamProvider {
6162
6162
  constructor(_root, _settings) {
@@ -6366,7 +6366,7 @@ reader.default = Reader;
6366
6366
  var stream$1 = {};
6367
6367
 
6368
6368
  Object.defineProperty(stream$1, "__esModule", { value: true });
6369
- const stream_1$3 = require$$0$1;
6369
+ const stream_1$3 = require$$0$2;
6370
6370
  const fsStat$1 = out$1;
6371
6371
  const fsWalk$2 = out$3;
6372
6372
  const reader_1$2 = reader;
@@ -6792,7 +6792,7 @@ async$7.default = ProviderAsync;
6792
6792
  var stream = {};
6793
6793
 
6794
6794
  Object.defineProperty(stream, "__esModule", { value: true });
6795
- const stream_1$1 = require$$0$1;
6795
+ const stream_1$1 = require$$0$2;
6796
6796
  const stream_2 = stream$1;
6797
6797
  const provider_1$1 = provider;
6798
6798
  class ProviderStream extends provider_1$1.default {
@@ -7164,7 +7164,6 @@ function createMethodsRPC(project) {
7164
7164
  };
7165
7165
  }
7166
7166
 
7167
- const childPath = fileURLToPath(pathToFileURL(resolve(distDir, "./child.js")).href);
7168
7167
  function createChildProcessChannel(project) {
7169
7168
  const emitter = new EventEmitter();
7170
7169
  const cleanup = () => emitter.removeAllListeners();
@@ -7195,7 +7194,7 @@ function stringifyRegex(input) {
7195
7194
  return input;
7196
7195
  return `$$vitest:${input.toString()}`;
7197
7196
  }
7198
- function createChildProcessPool(ctx, { execArgv, env }) {
7197
+ function createChildProcessPool(ctx, { execArgv, env, forksPath }) {
7199
7198
  var _a, _b, _c, _d, _e, _f, _g, _h;
7200
7199
  const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length;
7201
7200
  const threadsCount = ctx.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1);
@@ -7203,7 +7202,7 @@ function createChildProcessPool(ctx, { execArgv, env }) {
7203
7202
  const minThreads = ((_d = (_c = ctx.config.poolOptions) == null ? void 0 : _c.forks) == null ? void 0 : _d.minForks) ?? threadsCount;
7204
7203
  const options = {
7205
7204
  runtime: "child_process",
7206
- filename: childPath,
7205
+ filename: forksPath,
7207
7206
  maxThreads,
7208
7207
  minThreads,
7209
7208
  env,
@@ -7292,7 +7291,7 @@ function createChildProcessPool(ctx, { execArgv, env }) {
7292
7291
  const grouped = groupBy(files, ({ project, environment }) => project.getName() + environment.name + JSON.stringify(environment.options));
7293
7292
  for (const group of Object.values(grouped)) {
7294
7293
  results.push(...await Promise.allSettled(group.map(({ file, environment, project }) => runFiles(project, getConfig(project), [file], environment, invalidates))));
7295
- await new Promise((resolve2) => pool.queueSize === 0 ? resolve2() : pool.once("drain", resolve2));
7294
+ await new Promise((resolve) => pool.queueSize === 0 ? resolve() : pool.once("drain", resolve));
7296
7295
  await pool.recycleWorkers();
7297
7296
  }
7298
7297
  }
@@ -7327,7 +7326,6 @@ function createChildProcessPool(ctx, { execArgv, env }) {
7327
7326
  };
7328
7327
  }
7329
7328
 
7330
- const workerPath$1 = pathToFileURL(resolve(distDir, "./worker.js")).href;
7331
7329
  function createWorkerChannel$1(project) {
7332
7330
  const channel = new MessageChannel();
7333
7331
  const port = channel.port2;
@@ -7347,14 +7345,14 @@ function createWorkerChannel$1(project) {
7347
7345
  project.ctx.onCancel((reason) => rpc.onCancel(reason));
7348
7346
  return { workerPort, port };
7349
7347
  }
7350
- function createThreadsPool(ctx, { execArgv, env }) {
7348
+ function createThreadsPool(ctx, { execArgv, env, workerPath }) {
7351
7349
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7352
7350
  const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length;
7353
7351
  const threadsCount = ctx.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1);
7354
7352
  const maxThreads = ((_b = (_a = ctx.config.poolOptions) == null ? void 0 : _a.threads) == null ? void 0 : _b.maxThreads) ?? threadsCount;
7355
7353
  const minThreads = ((_d = (_c = ctx.config.poolOptions) == null ? void 0 : _c.threads) == null ? void 0 : _d.minThreads) ?? threadsCount;
7356
7354
  const options = {
7357
- filename: workerPath$1,
7355
+ filename: workerPath,
7358
7356
  // TODO: investigate further
7359
7357
  // It seems atomics introduced V8 Fatal Error https://github.com/vitest-dev/vitest/issues/1191
7360
7358
  useAtomics: ((_f = (_e = ctx.config.poolOptions) == null ? void 0 : _e.threads) == null ? void 0 : _f.useAtomics) ?? false,
@@ -7443,7 +7441,7 @@ function createThreadsPool(ctx, { execArgv, env }) {
7443
7441
  const grouped = groupBy(files, ({ project, environment }) => project.getName() + environment.name + JSON.stringify(environment.options));
7444
7442
  for (const group of Object.values(grouped)) {
7445
7443
  results.push(...await Promise.allSettled(group.map(({ file, environment, project }) => runFiles(project, getConfig(project), [file], environment, invalidates))));
7446
- await new Promise((resolve2) => pool.queueSize === 0 ? resolve2() : pool.once("drain", resolve2));
7444
+ await new Promise((resolve) => pool.queueSize === 0 ? resolve() : pool.once("drain", resolve));
7447
7445
  await pool.recycleWorkers();
7448
7446
  }
7449
7447
  }
@@ -7614,7 +7612,6 @@ function stringToBytes(input, percentageReference) {
7614
7612
  return null;
7615
7613
  }
7616
7614
 
7617
- const workerPath = pathToFileURL(resolve(distDir, "./vm.js")).href;
7618
7615
  const suppressWarningsPath = resolve(rootDir, "./suppress-warnings.cjs");
7619
7616
  function createWorkerChannel(project) {
7620
7617
  const channel = new MessageChannel();
@@ -7635,14 +7632,14 @@ function createWorkerChannel(project) {
7635
7632
  project.ctx.onCancel((reason) => rpc.onCancel(reason));
7636
7633
  return { workerPort, port };
7637
7634
  }
7638
- function createVmThreadsPool(ctx, { execArgv, env }) {
7635
+ function createVmThreadsPool(ctx, { execArgv, env, vmPath }) {
7639
7636
  var _a, _b, _c, _d, _e, _f, _g, _h;
7640
7637
  const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length;
7641
7638
  const threadsCount = ctx.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1);
7642
7639
  const maxThreads = ((_b = (_a = ctx.config.poolOptions) == null ? void 0 : _a.vmThreads) == null ? void 0 : _b.maxThreads) ?? threadsCount;
7643
7640
  const minThreads = ((_d = (_c = ctx.config.poolOptions) == null ? void 0 : _c.vmThreads) == null ? void 0 : _d.minThreads) ?? threadsCount;
7644
7641
  const options = {
7645
- filename: workerPath,
7642
+ filename: vmPath,
7646
7643
  // TODO: investigate further
7647
7644
  // It seems atomics introduced V8 Fatal Error https://github.com/vitest-dev/vitest/issues/1191
7648
7645
  useAtomics: ((_f = (_e = ctx.config.poolOptions) == null ? void 0 : _e.vmThreads) == null ? void 0 : _f.useAtomics) ?? false,
@@ -7770,6 +7767,7 @@ function createPool(ctx) {
7770
7767
  (execArg) => execArg.startsWith("--cpu-prof") || execArg.startsWith("--heap-prof")
7771
7768
  );
7772
7769
  const options = {
7770
+ ...ctx.projectFiles,
7773
7771
  execArgv: ctx.config.deps.registerNodeLoader ? [
7774
7772
  ...execArgv,
7775
7773
  "--require",
@@ -8045,13 +8043,14 @@ const defaultCoverageExcludes = [
8045
8043
  const coverageConfigDefaults = {
8046
8044
  provider: "v8",
8047
8045
  enabled: false,
8046
+ all: true,
8048
8047
  clean: true,
8049
8048
  cleanOnRerun: true,
8050
8049
  reportsDirectory: "./coverage",
8051
8050
  exclude: defaultCoverageExcludes,
8052
8051
  reportOnFailure: false,
8053
8052
  reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
8054
- extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"],
8053
+ extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
8055
8054
  allowExternal: false
8056
8055
  };
8057
8056
  const fakeTimersDefaults = {
@@ -9135,7 +9134,7 @@ createLogUpdate(process$1.stdout);
9135
9134
 
9136
9135
  createLogUpdate(process$1.stderr);
9137
9136
 
9138
- var version = "1.0.0-beta.0";
9137
+ var version = "1.0.0-beta.2";
9139
9138
 
9140
9139
  const A=r=>r!==null&&typeof r=="object",a=(r,t)=>Object.assign(new Error(`[${r}]: ${t}`),{code:r}),_$1="ERR_INVALID_PACKAGE_CONFIG",E="ERR_INVALID_PACKAGE_TARGET",I="ERR_PACKAGE_PATH_NOT_EXPORTED",R$1=/^\d+$/,O=/^(\.{1,2}|node_modules)$/i,w=/\/|\\/;var h=(r=>(r.Export="exports",r.Import="imports",r))(h||{});const f=(r,t,e,o,c)=>{if(t==null)return [];if(typeof t=="string"){const[n,...i]=t.split(w);if(n===".."||i.some(l=>O.test(l)))throw a(E,`Invalid "${r}" target "${t}" defined in the package config`);return [c?t.replace(/\*/g,c):t]}if(Array.isArray(t))return t.flatMap(n=>f(r,n,e,o,c));if(A(t)){for(const n of Object.keys(t)){if(R$1.test(n))throw a(_$1,"Cannot contain numeric property keys");if(n==="default"||o.includes(n))return f(r,t[n],e,o,c)}return []}throw a(E,`Invalid "${r}" target "${t}"`)},s="*",m=(r,t)=>{const e=r.indexOf(s),o=t.indexOf(s);return e===o?t.length>r.length:o>e};function d$1(r,t){if(!t.includes(s)&&r.hasOwnProperty(t))return [t];let e,o;for(const c of Object.keys(r))if(c.includes(s)){const[n,i,l]=c.split(s);if(l===void 0&&t.startsWith(n)&&t.endsWith(i)){const g=t.slice(n.length,-i.length||void 0);g&&(!e||m(e,c))&&(e=c,o=g);}}return [e,o]}const p=r=>Object.keys(r).reduce((t,e)=>{const o=e===""||e[0]!==".";if(t===void 0||t===o)return o;throw a(_$1,'"exports" cannot contain some keys starting with "." and some not')},void 0),u=/^\w+:/,v=(r,t,e)=>{if(!r)throw new Error('"exports" is required');t=t===""?".":`./${t}`,(typeof r=="string"||Array.isArray(r)||A(r)&&p(r))&&(r={".":r});const[o,c]=d$1(r,t),n=f(h.Export,r[o],t,e,c);if(n.length===0)throw a(I,t==="."?'No "exports" main defined':`Package subpath '${t}' is not defined by "exports"`);for(const i of n)if(!i.startsWith("./")&&!u.test(i))throw a(E,`Invalid "exports" target "${i}" defined in the package config`);return n};
9141
9140
 
@@ -10000,10 +9999,11 @@ function transformImportSpecifiers(node) {
10000
9999
  return `{ ${dynamicImports} }`;
10001
10000
  }
10002
10001
  const regexpHoistable = /^[ \t]*\b(vi|vitest)\s*\.\s*(mock|unmock|hoisted)\(/m;
10002
+ const regexpAssignedHoisted = /=[ \t]*(\bawait|)[ \t]*\b(vi|vitest)\s*\.\s*hoisted\(/;
10003
10003
  const hashbangRE = /^#!.*\n/;
10004
10004
  function hoistMocks(code, id, parse) {
10005
10005
  var _a;
10006
- const hasMocks = regexpHoistable.test(code);
10006
+ const hasMocks = regexpHoistable.test(code) || regexpAssignedHoisted.test(code);
10007
10007
  if (!hasMocks)
10008
10008
  return;
10009
10009
  const s = new MagicString(code);
@@ -10097,7 +10097,7 @@ ${err.message}`);
10097
10097
  return {
10098
10098
  ast,
10099
10099
  code: s.toString(),
10100
- map: s.generateMap({ hires: true, source: id })
10100
+ map: s.generateMap({ hires: "boundary", source: id })
10101
10101
  };
10102
10102
  }
10103
10103
 
@@ -10197,8 +10197,8 @@ function hijackVitePluginInject(viteConfig) {
10197
10197
  }
10198
10198
  function resolveFsAllow(projectRoot, rootConfigFile) {
10199
10199
  if (!rootConfigFile)
10200
- return [searchForWorkspaceRoot(projectRoot)];
10201
- return [dirname(rootConfigFile), searchForWorkspaceRoot(projectRoot)];
10200
+ return [searchForWorkspaceRoot(projectRoot), rootDir];
10201
+ return [dirname(rootConfigFile), searchForWorkspaceRoot(projectRoot), rootDir];
10202
10202
  }
10203
10203
 
10204
10204
  async function createBrowserServer(project, configFile) {
@@ -10249,7 +10249,7 @@ async function createBrowserServer(project, configFile) {
10249
10249
  });
10250
10250
  await server.listen();
10251
10251
  await server.watcher.close();
10252
- (await import('./chunk-api-setup.0aeabd21.js')).setup(project, server);
10252
+ (await import('./chunk-api-setup.5d9a93c7.js')).setup(project, server);
10253
10253
  return server;
10254
10254
  }
10255
10255
 
@@ -10461,7 +10461,7 @@ function SsrReplacerPlugin() {
10461
10461
  name: "vitest:ssr-replacer",
10462
10462
  enforce: "pre",
10463
10463
  transform(code, id) {
10464
- if (!/\bimport\.meta\.env\b/.test(code) && !/\bimport\.meta\.url\b/.test(code))
10464
+ if (!/\bimport\.meta\.env\b/.test(code))
10465
10465
  return null;
10466
10466
  let s = null;
10467
10467
  const cleanCode = stripLiteral(code);
@@ -10476,7 +10476,7 @@ function SsrReplacerPlugin() {
10476
10476
  return {
10477
10477
  code: s.toString(),
10478
10478
  map: s.generateMap({
10479
- hires: true,
10479
+ hires: "boundary",
10480
10480
  // Remove possible query parameters, e.g. vue's "?vue&type=script&src=true&lang.ts"
10481
10481
  source: cleanUrl(id)
10482
10482
  })
@@ -10521,6 +10521,33 @@ function VitestOptimizer() {
10521
10521
  };
10522
10522
  }
10523
10523
 
10524
+ const metaUrlLength = "import.meta.url".length;
10525
+ const locationString = "self.location".padEnd(metaUrlLength, " ");
10526
+ function NormalizeURLPlugin() {
10527
+ return {
10528
+ name: "vitest:normalize-url",
10529
+ enforce: "post",
10530
+ transform(code, id, options) {
10531
+ const ssr = (options == null ? void 0 : options.ssr) === true;
10532
+ if (ssr || !code.includes("new URL") || !code.includes("import.meta.url"))
10533
+ return;
10534
+ const cleanString = stripLiteral(code);
10535
+ const assetImportMetaUrlRE = /\bnew\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*(?:,\s*)?\)/g;
10536
+ let updatedCode = code;
10537
+ let match;
10538
+ while (match = assetImportMetaUrlRE.exec(cleanString)) {
10539
+ const { 0: exp, index } = match;
10540
+ const metaUrlIndex = index + exp.indexOf("import.meta.url");
10541
+ updatedCode = updatedCode.slice(0, metaUrlIndex) + locationString + updatedCode.slice(metaUrlIndex + metaUrlLength);
10542
+ }
10543
+ return {
10544
+ code: updatedCode,
10545
+ map: null
10546
+ };
10547
+ }
10548
+ };
10549
+ }
10550
+
10524
10551
  function WorkspaceVitestPlugin(project, options) {
10525
10552
  return [
10526
10553
  {
@@ -10618,7 +10645,8 @@ function WorkspaceVitestPlugin(project, options) {
10618
10645
  CoverageTransform(project.ctx),
10619
10646
  MocksPlugin(),
10620
10647
  VitestResolver(project.ctx),
10621
- VitestOptimizer()
10648
+ VitestOptimizer(),
10649
+ NormalizeURLPlugin()
10622
10650
  ];
10623
10651
  }
10624
10652
 
@@ -11027,6 +11055,7 @@ class Vitest {
11027
11055
  coreWorkspaceProject;
11028
11056
  projects = [];
11029
11057
  projectsTestFiles = /* @__PURE__ */ new Map();
11058
+ projectFiles;
11030
11059
  _onRestartListeners = [];
11031
11060
  _onSetServer = [];
11032
11061
  _onCancelListeners = [];
@@ -11049,6 +11078,13 @@ class Vitest {
11049
11078
  if (this.config.watch && this.mode !== "typecheck")
11050
11079
  this.registerWatcher();
11051
11080
  this.vitenode = new ViteNodeServer(server, this.config.server);
11081
+ const projectVitestPath = await this.vitenode.resolveId("vitest");
11082
+ const vitestDir = projectVitestPath ? resolve(projectVitestPath.id, "../..") : rootDir;
11083
+ this.projectFiles = {
11084
+ workerPath: join(vitestDir, "dist/worker.js"),
11085
+ forksPath: join(vitestDir, "dist/child.js"),
11086
+ vmPath: join(vitestDir, "dist/vm.js")
11087
+ };
11052
11088
  const node = this.vitenode;
11053
11089
  this.runner = new ViteNodeRunner({
11054
11090
  root: server.config.root,
@@ -11264,7 +11300,7 @@ class Vitest {
11264
11300
  }
11265
11301
  async filterTestsBySource(specs) {
11266
11302
  if (this.config.changed && !this.config.related) {
11267
- const { VitestGit } = await import('./chunk-node-git.36288174.js');
11303
+ const { VitestGit } = await import('./chunk-node-git.2f1df48f.js');
11268
11304
  const vitestGit = new VitestGit(this.config.root);
11269
11305
  const related2 = await vitestGit.findChangedFiles({
11270
11306
  changedSince: this.config.changed
@@ -11728,7 +11764,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11728
11764
  try {
11729
11765
  await ctx.setServer(options, server, userConfig);
11730
11766
  if (options.api && options.watch)
11731
- (await import('./chunk-api-setup.0aeabd21.js')).setup(ctx);
11767
+ (await import('./chunk-api-setup.5d9a93c7.js')).setup(ctx);
11732
11768
  } catch (err) {
11733
11769
  await ctx.logger.printError(err, { fullStack: true });
11734
11770
  process.exit(1);
@@ -11743,7 +11779,8 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11743
11779
  options.ui ? await UIPlugin() : null,
11744
11780
  MocksPlugin(),
11745
11781
  VitestResolver(ctx),
11746
- VitestOptimizer()
11782
+ VitestOptimizer(),
11783
+ NormalizeURLPlugin()
11747
11784
  ].filter(notNullish);
11748
11785
  }
11749
11786
 
@@ -12258,12 +12295,12 @@ function requirePrompt$1 () {
12258
12295
  if (hasRequiredPrompt$1) return prompt$2;
12259
12296
  hasRequiredPrompt$1 = 1;
12260
12297
 
12261
- const readline = require$$0$2;
12298
+ const readline = require$$0$3;
12262
12299
 
12263
12300
  const _require = requireUtil$1(),
12264
12301
  action = _require.action;
12265
12302
 
12266
- const EventEmitter = require$$2$1;
12303
+ const EventEmitter = require$$2;
12267
12304
 
12268
12305
  const _require2 = requireSrc(),
12269
12306
  beep = _require2.beep,
@@ -15423,9 +15460,9 @@ function requirePrompt () {
15423
15460
  if (hasRequiredPrompt) return prompt$1;
15424
15461
  hasRequiredPrompt = 1;
15425
15462
 
15426
- const readline = require$$0$2;
15463
+ const readline = require$$0$3;
15427
15464
  const { action } = requireUtil();
15428
- const EventEmitter = require$$2$1;
15465
+ const EventEmitter = require$$2;
15429
15466
  const { beep, cursor } = requireSrc();
15430
15467
  const color = requireKleur();
15431
15468
 
@@ -1,6 +1,7 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import c from 'picocolors';
3
3
  import { b as isNode, c as relativePath } from './vendor-index.29282562.js';
4
+ import { UNKNOWN_TEST_ID } from './chunk-runtime-console.f3263f87.js';
4
5
  import { isAbsolute, relative, dirname, basename, resolve } from 'pathe';
5
6
  import { s as slash } from './vendor-base.9c08bbd0.js';
6
7
  import { g as getFullName, h as hasFailedSnapshot } from './vendor-tasks.f9d75aed.js';
@@ -369,7 +370,7 @@ ${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
369
370
  if (!this.shouldLog(log))
370
371
  return;
371
372
  const task = log.taskId ? this.ctx.state.idMap.get(log.taskId) : void 0;
372
- const header = c.gray(log.type + c.dim(` | ${task ? getFullName(task, c.dim(" > ")) : "unknown test"}`));
373
+ const header = c.gray(log.type + c.dim(` | ${task ? getFullName(task, c.dim(" > ")) : log.taskId !== UNKNOWN_TEST_ID ? log.taskId : "unknown test"}`));
373
374
  process[log.type].write(`${header}
374
375
  ${log.content}
375
376
  `);