vitest 0.29.2 → 0.29.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.
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { startTests } from '@vitest/runner';
2
- import { a as ResolvedConfig } from './types-7cd96283.js';
2
+ import { a as ResolvedConfig } from './types-5872e574.js';
3
3
  export { s as setupSnapshotEnvironment } from './env-afee91f0.js';
4
4
  import '@vitest/expect';
5
5
  import 'vite';
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { startTests } from '@vitest/runner';
2
- export { s as setupCommonEnv } from './chunk-runtime-setup.992bb661.js';
2
+ export { s as setupCommonEnv } from './chunk-runtime-setup.ccad6a47.js';
3
3
  export { s as setupSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js';
4
4
  import '@vitest/utils';
5
5
  import './chunk-integrations-run-once.9012f759.js';
package/dist/child.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import v8 from 'node:v8';
2
2
  import { c as createBirpc } from './vendor-index.783e7f3e.js';
3
3
  import { parseRegexp } from '@vitest/utils';
4
- import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.a048e92d.js';
5
- import { a as rpcDone } from './chunk-runtime-rpc.971b3848.js';
4
+ import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.07568540.js';
5
+ import { a as rpcDone } from './chunk-runtime-rpc.1232904e.js';
6
+ import { s as setupInspect } from './chunk-runtime-inspector.b1427a10.js';
6
7
  import 'node:url';
7
8
  import 'vite-node/client';
8
9
  import 'vite-node/utils';
@@ -22,6 +23,7 @@ import 'std-env';
22
23
  import './chunk-constants.797d3ebf.js';
23
24
  import './chunk-utils-base.81f83dbd.js';
24
25
  import '@vitest/spy';
26
+ import 'node:inspector';
25
27
 
26
28
  function init(ctx) {
27
29
  const { config } = ctx;
@@ -69,10 +71,15 @@ function unwrapConfig(config) {
69
71
  return config;
70
72
  }
71
73
  async function run(ctx) {
72
- init(ctx);
73
- const { run: run2, executor } = await startViteNode(ctx);
74
- await run2(ctx.files, ctx.config, ctx.environment, executor);
75
- await rpcDone();
74
+ const inspectorCleanup = setupInspect(ctx.config);
75
+ try {
76
+ init(ctx);
77
+ const { run: run2, executor } = await startViteNode(ctx);
78
+ await run2(ctx.files, ctx.config, ctx.environment, executor);
79
+ await rpcDone();
80
+ } finally {
81
+ inspectorCleanup();
82
+ }
76
83
  }
77
84
  const procesExit = process.exit;
78
85
  process.on("message", async (message) => {
@@ -3,7 +3,7 @@ import k from 'path';
3
3
  import require$$0$1 from 'util';
4
4
  import require$$0$3 from 'child_process';
5
5
  import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.2cbcdd1e.js';
6
- import { o as onetime$1 } from './chunk-node-pkg.208acffb.js';
6
+ import { o as onetime$1 } from './chunk-node-pkg.7627b6fc.js';
7
7
  import require$$0$2 from 'os';
8
8
  import 'node:buffer';
9
9
  import 'node:path';
@@ -1,18 +1,18 @@
1
1
  import { g as globalApis } from './chunk-constants.797d3ebf.js';
2
- import { i as index } from './chunk-integrations-utils.233d6a3b.js';
2
+ import { i as index } from './chunk-integrations-utils.5243a0d7.js';
3
3
  import 'node:url';
4
4
  import 'pathe';
5
5
  import './chunk-utils-env.860d90c2.js';
6
6
  import 'std-env';
7
7
  import '@vitest/runner';
8
- import './chunk-utils-import.ec15dcad.js';
8
+ import './chunk-utils-import.8bd22905.js';
9
9
  import '@vitest/runner/utils';
10
10
  import '@vitest/utils';
11
11
  import './chunk-utils-global.727b6d25.js';
12
12
  import 'chai';
13
13
  import './vendor-_commonjsHelpers.addc3445.js';
14
14
  import '@vitest/expect';
15
- import './chunk-runtime-rpc.971b3848.js';
15
+ import './chunk-runtime-rpc.1232904e.js';
16
16
  import './chunk-snapshot-env.a347d647.js';
17
17
  import './chunk-utils-base.81f83dbd.js';
18
18
  import './chunk-utils-tasks.b41c8284.js';
@@ -1,5 +1,5 @@
1
1
  import { suite, test, describe, it, beforeAll, beforeEach, afterAll, afterEach, onTestFailed } from '@vitest/runner';
2
- import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.ec15dcad.js';
2
+ import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.8bd22905.js';
3
3
  import { r as runOnce, i as isFirstRun } from './chunk-integrations-run-once.9012f759.js';
4
4
  import * as chai from 'chai';
5
5
  import { assert, should } from 'chai';
@@ -62,7 +62,7 @@ function _mergeNamespaces(n, m) {
62
62
  return Object.freeze(n);
63
63
  }
64
64
 
65
- var version$1 = "0.29.2";
65
+ var version$1 = "0.29.3";
66
66
 
67
67
  async function ensurePackageInstalled(dependency, root) {
68
68
  if (isPackageExists(dependency, { paths: [root] }))
@@ -80,7 +80,7 @@ async function ensurePackageInstalled(dependency, root) {
80
80
  message: c.reset(`Do you want to install ${c.green(dependency)}?`)
81
81
  });
82
82
  if (install) {
83
- await (await import('./chunk-install-pkg.aa415fd6.js')).installPackage(dependency, { dev: true });
83
+ await (await import('./chunk-install-pkg.1dfb2c00.js')).installPackage(dependency, { dev: true });
84
84
  process.stderr.write(c.yellow(`
85
85
  Package ${dependency} installed, re-run the command to start.
86
86
  `));
@@ -7791,8 +7791,7 @@ function createPool(ctx) {
7791
7791
  "--require",
7792
7792
  suppressLoaderWarningsPath,
7793
7793
  "--experimental-loader",
7794
- loaderPath,
7795
- ...execArgv
7794
+ loaderPath
7796
7795
  ] : [
7797
7796
  ...execArgv,
7798
7797
  ...conditions
@@ -9221,10 +9220,12 @@ function renderBenchmark$1(task, tasks) {
9221
9220
  result.rank === 1 ? c.bold(c.green(" fastest")) : result.rank === benches.length && benches.length > 2 ? c.bold(c.gray(" slowest")) : ""
9222
9221
  ].join("");
9223
9222
  }
9224
- function renderTree$1(tasks, options, level = 0) {
9223
+ function renderTree$1(tasks, options, level = 0, maxRows) {
9225
9224
  var _a, _b, _c, _d, _e, _f, _g, _h;
9226
- let output = [];
9227
- for (const task of tasks) {
9225
+ const output = [];
9226
+ let currentRowCount = 0;
9227
+ for (const task of [...tasks].reverse()) {
9228
+ const taskOutput = [];
9228
9229
  let suffix = "";
9229
9230
  let prefix = ` ${getStateSymbol(task)} `;
9230
9231
  if (level === 0 && task.type === "suite" && task.projectName)
@@ -9248,7 +9249,7 @@ function renderTree$1(tasks, options, level = 0) {
9248
9249
  name = formatFilepath$1(name);
9249
9250
  const padding = " ".repeat(level);
9250
9251
  const body = ((_e = task.meta) == null ? void 0 : _e.benchmark) ? renderBenchmark$1(task, tasks) : name;
9251
- output.push(padding + prefix + body + suffix);
9252
+ taskOutput.push(padding + prefix + body + suffix);
9252
9253
  if (((_f = task.result) == null ? void 0 : _f.state) !== "pass" && outputMap$1.get(task) != null) {
9253
9254
  let data = outputMap$1.get(task);
9254
9255
  if (typeof data === "string") {
@@ -9258,37 +9259,46 @@ function renderTree$1(tasks, options, level = 0) {
9258
9259
  }
9259
9260
  if (data != null) {
9260
9261
  const out = `${" ".repeat(level)}${F_RIGHT} ${data}`;
9261
- output.push(` ${c.gray(cliTruncate(out, getCols(-3)))}`);
9262
+ taskOutput.push(` ${c.gray(cliTruncate(out, getCols(-3)))}`);
9262
9263
  }
9263
9264
  }
9264
- output = output.concat(renderHookState(task, "beforeAll", level + 1));
9265
- output = output.concat(renderHookState(task, "beforeEach", level + 1));
9265
+ taskOutput.push(renderHookState(task, "beforeAll", level + 1));
9266
+ taskOutput.push(renderHookState(task, "beforeEach", level + 1));
9266
9267
  if (task.type === "suite" && task.tasks.length > 0) {
9267
9268
  if (((_g = task.result) == null ? void 0 : _g.state) === "fail" || ((_h = task.result) == null ? void 0 : _h.state) === "run" || options.renderSucceed)
9268
- output = output.concat(renderTree$1(task.tasks, options, level + 1));
9269
- }
9270
- output = output.concat(renderHookState(task, "afterAll", level + 1));
9271
- output = output.concat(renderHookState(task, "afterEach", level + 1));
9269
+ taskOutput.push(renderTree$1(task.tasks, options, level + 1, maxRows));
9270
+ }
9271
+ taskOutput.push(renderHookState(task, "afterAll", level + 1));
9272
+ taskOutput.push(renderHookState(task, "afterEach", level + 1));
9273
+ const rows = taskOutput.filter(Boolean);
9274
+ output.push(rows.join("\n"));
9275
+ currentRowCount += rows.length;
9276
+ if (maxRows && currentRowCount >= maxRows)
9277
+ break;
9272
9278
  }
9273
- return output.filter(Boolean).join("\n");
9279
+ return output.reverse().join("\n");
9274
9280
  }
9275
9281
  const createListRenderer = (_tasks, options) => {
9276
9282
  let tasks = _tasks;
9277
9283
  let timer;
9278
9284
  const log = options.logger.logUpdate;
9279
9285
  function update() {
9280
- log(renderTree$1(tasks, options));
9286
+ log(renderTree$1(
9287
+ tasks,
9288
+ options,
9289
+ 0,
9290
+ process.stdout.rows
9291
+ ));
9281
9292
  }
9282
9293
  return {
9283
9294
  start() {
9284
9295
  if (timer)
9285
9296
  return this;
9286
- timer = setInterval(update, 200);
9297
+ timer = setInterval(update, 16);
9287
9298
  return this;
9288
9299
  },
9289
9300
  update(_tasks2) {
9290
9301
  tasks = _tasks2;
9291
- update();
9292
9302
  return this;
9293
9303
  },
9294
9304
  async stop() {
@@ -9360,25 +9370,45 @@ class DefaultReporter extends BaseReporter {
9360
9370
  }
9361
9371
  }
9362
9372
 
9363
- const check = c.green("\xB7");
9364
- const cross = c.red("x");
9365
- const pending = c.yellow("*");
9366
- const skip = c.dim(c.gray("-"));
9373
+ const check = { char: "\xB7", color: c.green };
9374
+ const cross = { char: "x", color: c.red };
9375
+ const pending = { char: "*", color: c.yellow };
9376
+ const skip = { char: "-", color: (char) => c.dim(c.gray(char)) };
9377
+ function getIcon(task) {
9378
+ var _a;
9379
+ if (task.mode === "skip" || task.mode === "todo")
9380
+ return skip;
9381
+ switch ((_a = task.result) == null ? void 0 : _a.state) {
9382
+ case "pass":
9383
+ return check;
9384
+ case "fail":
9385
+ return cross;
9386
+ default:
9387
+ return pending;
9388
+ }
9389
+ }
9367
9390
  function render(tasks) {
9368
9391
  const all = getTests(tasks);
9369
- return all.map((i) => {
9370
- var _a;
9371
- if (i.mode === "skip" || i.mode === "todo")
9372
- return skip;
9373
- switch ((_a = i.result) == null ? void 0 : _a.state) {
9374
- case "pass":
9375
- return check;
9376
- case "fail":
9377
- return cross;
9378
- default:
9379
- return pending;
9380
- }
9381
- }).join("");
9392
+ const output = [];
9393
+ let currentIcon = pending;
9394
+ let currentTasks = 0;
9395
+ const addOutput = () => output.push(currentIcon.color(currentIcon.char.repeat(currentTasks)));
9396
+ for (const task of all) {
9397
+ const icon = getIcon(task);
9398
+ const isLast = all.indexOf(task) === all.length - 1;
9399
+ if (icon === currentIcon) {
9400
+ currentTasks++;
9401
+ if (isLast)
9402
+ addOutput();
9403
+ continue;
9404
+ }
9405
+ addOutput();
9406
+ currentTasks = 1;
9407
+ currentIcon = icon;
9408
+ if (isLast)
9409
+ addOutput();
9410
+ }
9411
+ return output.join("");
9382
9412
  }
9383
9413
  const createDotRenderer = (_tasks, options) => {
9384
9414
  let tasks = _tasks;
@@ -9391,12 +9421,11 @@ const createDotRenderer = (_tasks, options) => {
9391
9421
  start() {
9392
9422
  if (timer)
9393
9423
  return this;
9394
- timer = setInterval(update, 200);
9424
+ timer = setInterval(update, 16);
9395
9425
  return this;
9396
9426
  },
9397
9427
  update(_tasks2) {
9398
9428
  tasks = _tasks2;
9399
- update();
9400
9429
  return this;
9401
9430
  },
9402
9431
  async stop() {
@@ -10055,7 +10084,7 @@ function renderBenchmark(task, tasks) {
10055
10084
  }
10056
10085
  function renderTree(tasks, options, level = 0) {
10057
10086
  var _a, _b, _c, _d, _e, _f;
10058
- let output = [];
10087
+ const output = [];
10059
10088
  let idx = 0;
10060
10089
  for (const task of tasks) {
10061
10090
  const padding = " ".repeat(level ? 1 : 0);
@@ -10094,7 +10123,7 @@ ${padding}`;
10094
10123
  }
10095
10124
  if (task.type === "suite" && task.tasks.length > 0) {
10096
10125
  if ((_f = task.result) == null ? void 0 : _f.state)
10097
- output = output.concat(renderTree(task.tasks, options, level + 1));
10126
+ output.push(renderTree(task.tasks, options, level + 1));
10098
10127
  }
10099
10128
  idx++;
10100
10129
  }
@@ -10645,6 +10674,12 @@ function resolveConfig(mode, options, viteConfig) {
10645
10674
  throw new Error("--shard <index> must be a positive number less then <count>");
10646
10675
  resolved.shard = { index, count };
10647
10676
  }
10677
+ if (resolved.inspect || resolved.inspectBrk) {
10678
+ if (resolved.threads !== false && resolved.singleThread !== true) {
10679
+ const inspectOption = `--inspect${resolved.inspectBrk ? "-brk" : ""}`;
10680
+ throw new Error(`You cannot use ${inspectOption} without "threads: false" or "singleThread: true"`);
10681
+ }
10682
+ }
10648
10683
  resolved.deps = resolved.deps || {};
10649
10684
  if (resolved.deps.inline !== true) {
10650
10685
  const ssrOptions = viteConfig.ssr;
@@ -11286,7 +11321,7 @@ createLogUpdate(process$1.stdout);
11286
11321
 
11287
11322
  createLogUpdate(process$1.stderr);
11288
11323
 
11289
- var version = "0.29.2";
11324
+ var version = "0.29.3";
11290
11325
 
11291
11326
  async function printError(error, ctx, options = {}) {
11292
11327
  const { showCodeFrame = true, fullStack = false, type } = options;
@@ -11304,6 +11339,8 @@ async function printError(error, ctx, options = {}) {
11304
11339
  stack: error2.stack
11305
11340
  };
11306
11341
  }
11342
+ if (!ctx.config)
11343
+ return printErrorMessage(e, ctx.logger);
11307
11344
  const stacks = parseErrorStacktrace(e, fullStack);
11308
11345
  const nearest = error instanceof TypeCheckError ? error.stacks[0] : stacks.find(
11309
11346
  (stack) => ctx.server.moduleGraph.getModuleById(stack.file) && existsSync$1(stack.file)
@@ -11324,6 +11361,7 @@ async function printError(error, ctx, options = {}) {
11324
11361
  }
11325
11362
  const testPath = e.VITEST_TEST_PATH;
11326
11363
  const testName = e.VITEST_TEST_NAME;
11364
+ const afterEnvTeardown = e.VITEST_AFTER_ENV_TEARDOWN;
11327
11365
  if (testPath)
11328
11366
  ctx.logger.error(c.red(`This error originated in "${c.bold(testPath)}" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.`));
11329
11367
  if (testName) {
@@ -11331,6 +11369,9 @@ async function printError(error, ctx, options = {}) {
11331
11369
  - The error was thrown, while Vitest was running this test.
11332
11370
  - This was the last recorded test before the error was thrown, if error originated after test finished its execution.`));
11333
11371
  }
11372
+ if (afterEnvTeardown) {
11373
+ ctx.logger.error(c.red("This error was caught after test environment was torn down. Make sure to cancel any running tasks before test finishes:\n- cancel timeouts using clearTimeout and clearInterval\n- wait for promises to resolve using the await keyword"));
11374
+ }
11334
11375
  if (typeof e.cause === "object" && e.cause && "name" in e.cause) {
11335
11376
  e.cause.name = `Caused by: ${e.cause.name}`;
11336
11377
  await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
@@ -11363,6 +11404,7 @@ const skipErrorProperties = /* @__PURE__ */ new Set([
11363
11404
  "expected",
11364
11405
  "VITEST_TEST_NAME",
11365
11406
  "VITEST_TEST_PATH",
11407
+ "VITEST_AFTER_ENV_TEARDOWN",
11366
11408
  ...Object.getOwnPropertyNames(Error.prototype),
11367
11409
  ...Object.getOwnPropertyNames(Object.prototype)
11368
11410
  ]);
@@ -12512,7 +12554,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
12512
12554
  };
12513
12555
  } else {
12514
12556
  const root = config.root || process.cwd();
12515
- const entries = await ctx.globAllTestFiles(preOptions, preOptions.dir || root);
12557
+ const [...entries] = await ctx.globAllTestFiles(preOptions, preOptions.dir || root);
12516
12558
  if (preOptions == null ? void 0 : preOptions.setupFiles) {
12517
12559
  const setupFiles = toArray$1(preOptions.setupFiles).map(
12518
12560
  (file) => normalize(
@@ -12575,7 +12617,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
12575
12617
  if (options.api && options.watch)
12576
12618
  (await import('./chunk-api-setup.d9eccaeb.js')).setup(ctx);
12577
12619
  } catch (err) {
12578
- ctx.logger.printError(err, true);
12620
+ await ctx.logger.printError(err, true);
12579
12621
  process.exit(1);
12580
12622
  }
12581
12623
  if (!options.watch)
@@ -0,0 +1,20 @@
1
+ import inspector from 'node:inspector';
2
+
3
+ function setupInspect(config) {
4
+ const isEnabled = config.inspect || config.inspectBrk;
5
+ if (isEnabled) {
6
+ const isOpen = inspector.url() !== void 0;
7
+ if (!isOpen) {
8
+ inspector.open();
9
+ if (config.inspectBrk)
10
+ inspector.waitForDebugger();
11
+ }
12
+ }
13
+ const keepOpen = config.watch && !config.isolate && config.singleThread;
14
+ return function cleanup() {
15
+ if (isEnabled && !keepOpen)
16
+ inspector.close();
17
+ };
18
+ }
19
+
20
+ export { setupInspect as s };
@@ -10,7 +10,7 @@ import { existsSync, readdirSync } from 'node:fs';
10
10
  import { getColors, getType } from '@vitest/utils';
11
11
  import { e as getAllMockableProperties } from './chunk-utils-base.81f83dbd.js';
12
12
  import { spyOn } from '@vitest/spy';
13
- import { r as rpc } from './chunk-runtime-rpc.971b3848.js';
13
+ import { r as rpc } from './chunk-runtime-rpc.1232904e.js';
14
14
 
15
15
  class RefTracker {
16
16
  constructor() {
@@ -321,6 +321,7 @@ async function startViteNode(ctx) {
321
321
  error.VITEST_TEST_NAME = (_a = worker.current) == null ? void 0 : _a.name;
322
322
  error.VITEST_TEST_PATH = relative(config.root, worker.filepath);
323
323
  }
324
+ error.VITEST_AFTER_ENV_TEARDOWN = worker.environmentTeardownRun;
324
325
  rpc().onUnhandledError(error, type);
325
326
  }
326
327
  process.on("uncaughtException", (e) => catchError(e, "Uncaught Exception"));
@@ -32,7 +32,7 @@ function withSafeTimers(fn) {
32
32
  }
33
33
  }
34
34
  const promises = /* @__PURE__ */ new Set();
35
- const rpcDone = () => {
35
+ const rpcDone = async () => {
36
36
  if (!promises.size)
37
37
  return;
38
38
  const awaitable = Array.from(promises);
@@ -10,7 +10,7 @@ async function setupCommonEnv(config) {
10
10
  globalSetup = true;
11
11
  setSafeTimers();
12
12
  if (config.globals)
13
- (await import('./chunk-integrations-globals.b56fcb06.js')).registerApiGlobally();
13
+ (await import('./chunk-integrations-globals.85aeb216.js')).registerApiGlobally();
14
14
  }
15
15
  function setupDefines(defines) {
16
16
  for (const key in defines)
@@ -6,7 +6,7 @@ import * as chai$1 from 'chai';
6
6
  import { expect } from 'chai';
7
7
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
8
8
  import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, getState, setState } from '@vitest/expect';
9
- import { r as rpc } from './chunk-runtime-rpc.971b3848.js';
9
+ import { r as rpc } from './chunk-runtime-rpc.1232904e.js';
10
10
  import { join, dirname } from 'pathe';
11
11
  import { g as getSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js';
12
12
  import { i as isObject } from './chunk-utils-base.81f83dbd.js';
@@ -23,8 +23,6 @@ import 'std-env';
23
23
 
24
24
  const ENTRY = new URL("./cli.js", import.meta.url);
25
25
  const NODE_ARGS = [
26
- "--inspect",
27
- "--inspect-brk",
28
26
  "--trace-deprecation",
29
27
  "--experimental-wasm-threads",
30
28
  "--wasm-atomics-on-non-shared-memory"
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { normalize } from 'pathe';
2
2
  import cac from 'cac';
3
3
  import c from 'picocolors';
4
- import { v as version, s as startVitest, d as divider } from './chunk-node-pkg.208acffb.js';
4
+ import { v as version, s as startVitest, d as divider } from './chunk-node-pkg.7627b6fc.js';
5
5
  import './chunk-constants.797d3ebf.js';
6
6
  import 'node:url';
7
7
  import './chunk-utils-env.860d90c2.js';
package/dist/config.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv } from 'vite';
3
- import { a3 as ResolvedCoverageOptions, U as UserConfig$1, a6 as CoverageC8Options, a7 as CustomProviderOptions, a5 as CoverageIstanbulOptions, ah as HtmlOptions, ai as FileOptions, aj as CloverOptions, ak as CoberturaOptions, al as HtmlSpaOptions, am as LcovOptions, an as LcovOnlyOptions, ao as TeamcityOptions, ap as TextOptions, aq as ProjectOptions, F as FakeTimerInstallOpts } from './types-7cd96283.js';
3
+ import { a2 as ResolvedCoverageOptions, U as UserConfig$1, a5 as CoverageC8Options, a6 as CustomProviderOptions, a4 as CoverageIstanbulOptions, ag as HtmlOptions, ah as FileOptions, ai as CloverOptions, aj as CoberturaOptions, ak as HtmlSpaOptions, al as LcovOptions, am as LcovOnlyOptions, an as TeamcityOptions, ao as TextOptions, ap as ProjectOptions, F as FakeTimerInstallOpts } from './types-5872e574.js';
4
4
  import '@vitest/expect';
5
- import '@vitest/runner/types';
6
5
  import '@vitest/runner';
6
+ import '@vitest/runner/types';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
@@ -1,8 +1,8 @@
1
- import { a4 as BaseCoverageOptions, a3 as ResolvedCoverageOptions } from './types-7cd96283.js';
1
+ import { a3 as BaseCoverageOptions, a2 as ResolvedCoverageOptions } from './types-5872e574.js';
2
2
  import '@vitest/expect';
3
3
  import 'vite';
4
- import '@vitest/runner/types';
5
4
  import '@vitest/runner';
5
+ import '@vitest/runner/types';
6
6
  import '@vitest/runner/utils';
7
7
  import '@vitest/utils';
8
8
  import 'tinybench';
package/dist/entry.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import { startTests } from '@vitest/runner';
2
2
  import { resolve } from 'pathe';
3
3
  import { g as getWorkerState, r as resetModules } from './chunk-utils-global.727b6d25.js';
4
- import { R as RealDate, g as globalExpect, a as vi } from './chunk-utils-import.ec15dcad.js';
4
+ import { R as RealDate, g as globalExpect, a as vi } from './chunk-utils-import.8bd22905.js';
5
5
  import { d as distDir } from './chunk-constants.797d3ebf.js';
6
6
  import { s as startCoverageInsideWorker, t as takeCoverageInsideWorker, a as stopCoverageInsideWorker } from './chunk-integrations-coverage.e0a6acd2.js';
7
7
  import { createRequire } from 'node:module';
8
- import c from 'picocolors';
8
+ import { isatty } from 'node:tty';
9
9
  import { installSourcemapsSupport } from 'vite-node/source-map';
10
- import { setColors, getSafeTimers } from '@vitest/utils';
10
+ import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
11
11
  import { e as environments } from './chunk-env-node.affdd278.js';
12
- import { i as index } from './chunk-integrations-utils.233d6a3b.js';
12
+ import { i as index } from './chunk-integrations-utils.5243a0d7.js';
13
13
  import { s as setupSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js';
14
14
  import { promises, existsSync } from 'node:fs';
15
- import { r as rpc } from './chunk-runtime-rpc.971b3848.js';
16
- import { s as setupCommonEnv } from './chunk-runtime-setup.992bb661.js';
15
+ import { r as rpc } from './chunk-runtime-rpc.1232904e.js';
16
+ import { s as setupCommonEnv } from './chunk-runtime-setup.ccad6a47.js';
17
17
  import './chunk-utils-env.860d90c2.js';
18
18
  import 'std-env';
19
19
  import '@vitest/runner/utils';
@@ -61,11 +61,11 @@ async function setupGlobalEnv(config) {
61
61
  return;
62
62
  globalSetup = true;
63
63
  setupSnapshotEnvironment(new NodeSnapshotEnvironment());
64
- setColors(c);
65
- const require = createRequire(import.meta.url);
66
- require.extensions[".css"] = () => ({});
67
- require.extensions[".scss"] = () => ({});
68
- require.extensions[".sass"] = () => ({});
64
+ setupColors(createColors(isatty(1)));
65
+ const _require = createRequire(import.meta.url);
66
+ _require.extensions[".css"] = () => ({});
67
+ _require.extensions[".scss"] = () => ({});
68
+ _require.extensions[".sass"] = () => ({});
69
69
  const state = getWorkerState();
70
70
  installSourcemapsSupport({
71
71
  getSourceMap: (source) => state.moduleCache.getSourceMap(source)
@@ -194,6 +194,8 @@ async function withEnv(name, options, executor, fn) {
194
194
  try {
195
195
  await fn();
196
196
  } finally {
197
+ const { setTimeout } = getSafeTimers();
198
+ await new Promise((resolve) => setTimeout(resolve));
197
199
  await env.teardown(globalThis);
198
200
  }
199
201
  }
@@ -260,6 +262,7 @@ async function run(files, config, environment, executor) {
260
262
  }
261
263
  await stopCoverageInsideWorker(config.coverage, executor);
262
264
  });
265
+ workerState.environmentTeardownRun = true;
263
266
  }
264
267
 
265
268
  export { run };
@@ -1,8 +1,8 @@
1
- import { X as Environment } from './types-7cd96283.js';
1
+ import { Q as Environment } from './types-5872e574.js';
2
2
  import '@vitest/expect';
3
3
  import 'vite';
4
- import '@vitest/runner/types';
5
4
  import '@vitest/runner';
5
+ import '@vitest/runner/types';
6
6
  import '@vitest/runner/utils';
7
7
  import '@vitest/utils';
8
8
  import 'tinybench';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Test } from '@vitest/runner';
2
- export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
3
- import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, a as ResolvedConfig, b as ModuleGraphData, S as SnapshotResult, c as Reporter } from './types-7cd96283.js';
4
- export { x as AfterSuiteRunMeta, A as ApiConfig, G as ArgumentsType, D as Arrayable, z as Awaitable, a4 as BaseCoverageOptions, ab as BenchFunction, a9 as Benchmark, B as BenchmarkAPI, aa as BenchmarkResult, a8 as BenchmarkUserOptions, h as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, e as CollectLines, O as Constructable, g as Context, o as ContextRPC, n as ContextTestEnvironment, a6 as CoverageC8Options, a5 as CoverageIstanbulOptions, a2 as CoverageOptions, _ as CoverageProvider, a0 as CoverageProviderModule, a1 as CoverageReporter, a7 as CustomProviderOptions, K as DeepMerge, X as Environment, E as EnvironmentOptions, Q as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, H as MergeInsertions, P as ModuleCache, b as ModuleGraphData, L as MutableArray, N as Nullable, Z as OnServerRestartHandler, d as RawErrsMap, $ as ReportContext, c as Reporter, w as ResolveIdFunction, a as ResolvedConfig, a3 as ResolvedCoverageOptions, f as RootAndTarget, R as RuntimeConfig, m as RuntimeRPC, j as SequenceHooks, q as SnapshotData, t as SnapshotMatchOptions, S as SnapshotResult, s as SnapshotStateOptions, v as SnapshotSummary, r as SnapshotUpdateState, T as TscErrorInfo, l as TypecheckConfig, u as UncheckedSnapshot, U as UserConfig, Y as UserConsoleLog, p as Vitest, V as VitestEnvironment, k as VitestRunMode, W as WorkerContext, y as WorkerGlobalState } from './types-7cd96283.js';
2
+ export { SequenceHooks, SequenceSetupFiles, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
3
+ import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, a as ResolvedConfig, b as ModuleGraphData, S as SnapshotResult, c as Reporter } from './types-5872e574.js';
4
+ export { w as AfterSuiteRunMeta, A as ApiConfig, D as ArgumentsType, z as Arrayable, y as Awaitable, a3 as BaseCoverageOptions, aa as BenchFunction, a8 as Benchmark, B as BenchmarkAPI, a9 as BenchmarkResult, a7 as BenchmarkUserOptions, h as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, e as CollectLines, L as Constructable, g as Context, n as ContextRPC, m as ContextTestEnvironment, a5 as CoverageC8Options, a4 as CoverageIstanbulOptions, a1 as CoverageOptions, Z as CoverageProvider, $ as CoverageProviderModule, a0 as CoverageReporter, a6 as CustomProviderOptions, H as DeepMerge, Q as Environment, E as EnvironmentOptions, P as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, G as MergeInsertions, O as ModuleCache, b as ModuleGraphData, K as MutableArray, N as Nullable, Y as OnServerRestartHandler, d as RawErrsMap, _ as ReportContext, c as Reporter, v as ResolveIdFunction, a as ResolvedConfig, a2 as ResolvedCoverageOptions, f as RootAndTarget, R as RuntimeConfig, l as RuntimeRPC, p as SnapshotData, s as SnapshotMatchOptions, S as SnapshotResult, r as SnapshotStateOptions, u as SnapshotSummary, q as SnapshotUpdateState, T as TscErrorInfo, k as TypecheckConfig, t as UncheckedSnapshot, U as UserConfig, X as UserConsoleLog, o as Vitest, V as VitestEnvironment, j as VitestRunMode, W as WorkerContext, x as WorkerGlobalState } from './types-5872e574.js';
5
5
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
6
6
  export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
7
7
  export { S as SnapshotEnvironment } from './env-afee91f0.js';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
- export { b as bench, c as createExpect, g as expect, a as vi, v as vitest } from './chunk-utils-import.ec15dcad.js';
2
+ export { b as bench, c as createExpect, g as expect, a as vi, v as vitest } from './chunk-utils-import.8bd22905.js';
3
3
  export { i as isFirstRun, r as runOnce } from './chunk-integrations-run-once.9012f759.js';
4
- import { d as dist } from './chunk-integrations-utils.233d6a3b.js';
5
- export { b as assertType, g as getRunningMode, a as isWatchMode } from './chunk-integrations-utils.233d6a3b.js';
4
+ import { d as dist } from './chunk-integrations-utils.5243a0d7.js';
5
+ export { b as assertType, g as getRunningMode, a as isWatchMode } from './chunk-integrations-utils.5243a0d7.js';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
8
8
  export { assert, should } from 'chai';
@@ -14,7 +14,7 @@ import './chunk-utils-env.860d90c2.js';
14
14
  import 'std-env';
15
15
  import './vendor-_commonjsHelpers.addc3445.js';
16
16
  import '@vitest/expect';
17
- import './chunk-runtime-rpc.971b3848.js';
17
+ import './chunk-runtime-rpc.1232904e.js';
18
18
  import './chunk-snapshot-env.a347d647.js';
19
19
  import './chunk-utils-base.81f83dbd.js';
20
20
  import './chunk-utils-tasks.b41c8284.js';
package/dist/node.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { k as VitestRunMode, U as UserConfig, p as Vitest, ac as MockFactory, ad as MockMap, ae as TestSequencer } from './types-7cd96283.js';
2
- export { ae as TestSequencer, ag as TestSequencerConstructor, p as Vitest, af as startVitest } from './types-7cd96283.js';
1
+ import { j as VitestRunMode, U as UserConfig, o as Vitest, ab as MockFactory, ac as MockMap, ad as TestSequencer } from './types-5872e574.js';
2
+ export { ad as TestSequencer, af as TestSequencerConstructor, o as Vitest, ae as startVitest } from './types-5872e574.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import { ViteNodeRunner } from 'vite-node/client';
5
5
  import { ViteNodeRunnerOptions } from 'vite-node';
6
6
  import '@vitest/expect';
7
- import '@vitest/runner/types';
8
7
  import '@vitest/runner';
8
+ import '@vitest/runner/types';
9
9
  import '@vitest/runner/utils';
10
10
  import '@vitest/utils';
11
11
  import 'tinybench';
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-node-pkg.208acffb.js';
2
- export { V as VitestExecutor } from './chunk-runtime-mocker.a048e92d.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-node-pkg.7627b6fc.js';
2
+ export { V as VitestExecutor } from './chunk-runtime-mocker.07568540.js';
3
3
  import 'pathe';
4
4
  import './chunk-constants.797d3ebf.js';
5
5
  import 'node:url';
@@ -57,4 +57,4 @@ import './vendor-index.bdee400f.js';
57
57
  import 'node:assert';
58
58
  import 'node:util';
59
59
  import '@vitest/spy';
60
- import './chunk-runtime-rpc.971b3848.js';
60
+ import './chunk-runtime-rpc.1232904e.js';
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Test, TestContext } from '@vitest/runner';
2
- import { a as ResolvedConfig } from './types-7cd96283.js';
2
+ import { a as ResolvedConfig } from './types-5872e574.js';
3
3
  import '@vitest/expect';
4
4
  import 'vite';
5
5
  import '@vitest/runner/types';
package/dist/runners.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { d as getSnapshotClient, c as createExpect, a as vi, e as getBenchOptions, f as getBenchFn } from './chunk-utils-import.ec15dcad.js';
2
+ import { d as getSnapshotClient, c as createExpect, a as vi, e as getBenchOptions, f as getBenchFn } from './chunk-utils-import.8bd22905.js';
3
3
  import { g as getWorkerState } from './chunk-utils-global.727b6d25.js';
4
4
  import { g as getFullName } from './chunk-utils-tasks.b41c8284.js';
5
5
  import { updateTask } from '@vitest/runner';
@@ -7,7 +7,7 @@ import { createDefer, getSafeTimers } from '@vitest/utils';
7
7
  import '@vitest/runner/utils';
8
8
  import 'chai';
9
9
  import './vendor-_commonjsHelpers.addc3445.js';
10
- import './chunk-runtime-rpc.971b3848.js';
10
+ import './chunk-runtime-rpc.1232904e.js';
11
11
  import 'pathe';
12
12
  import './chunk-snapshot-env.a347d647.js';
13
13
  import './chunk-utils-base.81f83dbd.js';
@@ -1,8 +1,8 @@
1
1
  import { MatchersObject, MatcherState } from '@vitest/expect';
2
2
  import { UserConfig as UserConfig$1, ViteDevServer, CommonServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
3
- import { File, Test as Test$1, Suite, TaskResultPack, Task } from '@vitest/runner/types';
4
3
  import * as _vitest_runner from '@vitest/runner';
5
- import { Task as Task$1, Test as Test$2, TaskCustom } from '@vitest/runner';
4
+ import { Task as Task$1, Test as Test$2, TaskCustom, SequenceSetupFiles, SequenceHooks } from '@vitest/runner';
5
+ import { File, Test as Test$1, Suite, TaskResultPack, Task } from '@vitest/runner/types';
6
6
  import { ParsedStack, ErrorWithDiff, ChainableFunction } from '@vitest/runner/utils';
7
7
  import { Arrayable as Arrayable$1 } from '@vitest/utils';
8
8
  import { Task as Task$2, TaskResult, Bench, Options } from 'tinybench';
@@ -1075,6 +1075,7 @@ interface WorkerGlobalState {
1075
1075
  rpc: BirpcReturn<RuntimeRPC>;
1076
1076
  current?: Test$2;
1077
1077
  filepath?: string;
1078
+ environmentTeardownRun?: boolean;
1078
1079
  moduleCache: ModuleCacheMap;
1079
1080
  mockMap: MockMap;
1080
1081
  }
@@ -1406,7 +1407,6 @@ type BenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', [
1406
1407
  type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
1407
1408
  type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
1408
1409
  type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
1409
- type SequenceHooks = 'stack' | 'list' | 'parallel';
1410
1410
  type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
1411
1411
 
1412
1412
  interface EnvironmentOptions {
@@ -1825,6 +1825,13 @@ interface InlineConfig {
1825
1825
  * @default false
1826
1826
  */
1827
1827
  shuffle?: boolean;
1828
+ /**
1829
+ * Defines how setup files should be ordered
1830
+ * - 'parallel' will run all setup files in parallel
1831
+ * - 'list' will run all setup files in the order they are defined in the config file
1832
+ * @default 'parallel'
1833
+ */
1834
+ setupFiles?: SequenceSetupFiles;
1828
1835
  /**
1829
1836
  * Seed for the random number generator.
1830
1837
  * @default Date.now()
@@ -1863,6 +1870,18 @@ interface InlineConfig {
1863
1870
  * Path to a custom test runner.
1864
1871
  */
1865
1872
  runner?: string;
1873
+ /**
1874
+ * Debug tests by opening `node:inspector` in worker / child process.
1875
+ * Provides similar experience as `--inspect` Node CLI argument.
1876
+ * Requires `singleThread: true` OR `threads: false`.
1877
+ */
1878
+ inspect?: boolean;
1879
+ /**
1880
+ * Debug tests by opening `node:inspector` in worker / child process and wait for debugger to connect.
1881
+ * Provides similar experience as `--inspect-brk` Node CLI argument.
1882
+ * Requires `singleThread: true` OR `threads: false`.
1883
+ */
1884
+ inspectBrk?: boolean;
1866
1885
  }
1867
1886
  interface TypecheckConfig {
1868
1887
  /**
@@ -1952,6 +1971,7 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
1952
1971
  sequence: {
1953
1972
  sequencer: TestSequencerConstructor;
1954
1973
  hooks: SequenceHooks;
1974
+ setupFiles: SequenceSetupFiles;
1955
1975
  shuffle?: boolean;
1956
1976
  seed: number;
1957
1977
  };
@@ -2166,4 +2186,4 @@ type Context = RootAndTarget & {
2166
2186
  lastActivePath?: string;
2167
2187
  };
2168
2188
 
2169
- export { ReportContext as $, ApiConfig as A, BenchmarkAPI as B, CollectLineNumbers as C, Arrayable as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, ArgumentsType$1 as G, MergeInsertions as H, InlineConfig as I, JSDOMOptions as J, DeepMerge as K, MutableArray as L, MockFactoryWithHelper as M, Nullable as N, Constructable as O, ModuleCache as P, EnvironmentReturn as Q, RuntimeConfig as R, SnapshotResult as S, TscErrorInfo as T, UserConfig as U, VitestEnvironment as V, WorkerContext as W, Environment as X, UserConsoleLog as Y, OnServerRestartHandler as Z, CoverageProvider as _, ResolvedConfig as a, CoverageProviderModule as a0, CoverageReporter as a1, CoverageOptions as a2, ResolvedCoverageOptions as a3, BaseCoverageOptions as a4, CoverageIstanbulOptions as a5, CoverageC8Options as a6, CustomProviderOptions as a7, BenchmarkUserOptions as a8, Benchmark as a9, BenchmarkResult as aa, BenchFunction as ab, MockFactory as ac, MockMap as ad, TestSequencer as ae, startVitest as af, TestSequencerConstructor as ag, HtmlOptions as ah, FileOptions as ai, CloverOptions as aj, CoberturaOptions as ak, HtmlSpaOptions as al, LcovOptions as am, LcovOnlyOptions as an, TeamcityOptions as ao, TextOptions as ap, ProjectOptions as aq, ModuleGraphData as b, Reporter as c, RawErrsMap as d, CollectLines as e, RootAndTarget as f, Context as g, BuiltinEnvironment as h, CSSModuleScopeStrategy as i, SequenceHooks as j, VitestRunMode as k, TypecheckConfig as l, RuntimeRPC as m, ContextTestEnvironment as n, ContextRPC as o, Vitest as p, SnapshotData as q, SnapshotUpdateState as r, SnapshotStateOptions as s, SnapshotMatchOptions as t, UncheckedSnapshot as u, SnapshotSummary as v, ResolveIdFunction as w, AfterSuiteRunMeta as x, WorkerGlobalState as y, Awaitable as z };
2189
+ export { CoverageProviderModule as $, ApiConfig as A, BenchmarkAPI as B, CollectLineNumbers as C, ArgumentsType$1 as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, MergeInsertions as G, DeepMerge as H, InlineConfig as I, JSDOMOptions as J, MutableArray as K, Constructable as L, MockFactoryWithHelper as M, Nullable as N, ModuleCache as O, EnvironmentReturn as P, Environment as Q, RuntimeConfig as R, SnapshotResult as S, TscErrorInfo as T, UserConfig as U, VitestEnvironment as V, WorkerContext as W, UserConsoleLog as X, OnServerRestartHandler as Y, CoverageProvider as Z, ReportContext as _, ResolvedConfig as a, CoverageReporter as a0, CoverageOptions as a1, ResolvedCoverageOptions as a2, BaseCoverageOptions as a3, CoverageIstanbulOptions as a4, CoverageC8Options as a5, CustomProviderOptions as a6, BenchmarkUserOptions as a7, Benchmark as a8, BenchmarkResult as a9, BenchFunction as aa, MockFactory as ab, MockMap as ac, TestSequencer as ad, startVitest as ae, TestSequencerConstructor as af, HtmlOptions as ag, FileOptions as ah, CloverOptions as ai, CoberturaOptions as aj, HtmlSpaOptions as ak, LcovOptions as al, LcovOnlyOptions as am, TeamcityOptions as an, TextOptions as ao, ProjectOptions as ap, ModuleGraphData as b, Reporter as c, RawErrsMap as d, CollectLines as e, RootAndTarget as f, Context as g, BuiltinEnvironment as h, CSSModuleScopeStrategy as i, VitestRunMode as j, TypecheckConfig as k, RuntimeRPC as l, ContextTestEnvironment as m, ContextRPC as n, Vitest as o, SnapshotData as p, SnapshotUpdateState as q, SnapshotStateOptions as r, SnapshotMatchOptions as s, UncheckedSnapshot as t, SnapshotSummary as u, ResolveIdFunction as v, AfterSuiteRunMeta as w, WorkerGlobalState as x, Awaitable as y, Arrayable as z };
package/dist/worker.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { c as createBirpc } from './vendor-index.783e7f3e.js';
2
2
  import { workerId } from 'tinypool';
3
3
  import { g as getWorkerState } from './chunk-utils-global.727b6d25.js';
4
- import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.a048e92d.js';
5
- import { a as rpcDone } from './chunk-runtime-rpc.971b3848.js';
4
+ import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.07568540.js';
5
+ import { s as setupInspect } from './chunk-runtime-inspector.b1427a10.js';
6
+ import { a as rpcDone } from './chunk-runtime-rpc.1232904e.js';
6
7
  import 'pathe';
7
8
  import './chunk-utils-env.860d90c2.js';
8
9
  import 'std-env';
@@ -23,6 +24,7 @@ import 'node:util';
23
24
  import './chunk-constants.797d3ebf.js';
24
25
  import './chunk-utils-base.81f83dbd.js';
25
26
  import '@vitest/spy';
27
+ import 'node:inspector';
26
28
 
27
29
  function init(ctx) {
28
30
  if (typeof __vitest_worker__ !== "undefined" && ctx.config.threads && ctx.config.isolate)
@@ -58,10 +60,15 @@ function init(ctx) {
58
60
  ctx.files.forEach((i) => moduleCache.delete(i));
59
61
  }
60
62
  async function run(ctx) {
61
- init(ctx);
62
- const { run: run2, executor } = await startViteNode(ctx);
63
- await run2(ctx.files, ctx.config, ctx.environment, executor);
64
- await rpcDone();
63
+ const inspectorCleanup = setupInspect(ctx.config);
64
+ try {
65
+ init(ctx);
66
+ const { run: run2, executor } = await startViteNode(ctx);
67
+ await run2(ctx.files, ctx.config, ctx.environment, executor);
68
+ await rpcDone();
69
+ } finally {
70
+ inspectorCleanup();
71
+ }
65
72
  }
66
73
 
67
74
  export { run };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "0.29.2",
4
+ "version": "0.29.3",
5
5
  "description": "A blazing fast unit test framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -132,11 +132,11 @@
132
132
  "tinyspy": "^1.0.2",
133
133
  "vite": "^3.0.0 || ^4.0.0",
134
134
  "why-is-node-running": "^2.2.2",
135
- "@vitest/utils": "0.29.2",
136
- "vite-node": "0.29.2",
137
- "@vitest/spy": "0.29.2",
138
- "@vitest/runner": "0.29.2",
139
- "@vitest/expect": "0.29.2"
135
+ "@vitest/expect": "0.29.3",
136
+ "@vitest/runner": "0.29.3",
137
+ "vite-node": "0.29.3",
138
+ "@vitest/spy": "0.29.3",
139
+ "@vitest/utils": "0.29.3"
140
140
  },
141
141
  "devDependencies": {
142
142
  "@antfu/install-pkg": "^0.1.1",