vitest 2.0.0-beta.1 → 2.0.0-beta.11

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 (66) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/browser.d.ts +22 -2
  3. package/dist/browser.js +5 -3
  4. package/dist/chunks/{integrations-globals.B5Jl0grA.js → integrations-globals.CC2ed6Py.js} +9 -9
  5. package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
  6. package/dist/chunks/{runtime-console.CUES-L8X.js → runtime-console.Ckl0vEQr.js} +76 -31
  7. package/dist/chunks/{runtime-runBaseTests._dXkRAZc.js → runtime-runBaseTests.BXW_BJeO.js} +40 -32
  8. package/dist/cli.js +3 -3
  9. package/dist/config.cjs +43 -20
  10. package/dist/config.d.ts +2 -2
  11. package/dist/config.js +43 -21
  12. package/dist/coverage.d.ts +4 -4
  13. package/dist/coverage.js +125 -37
  14. package/dist/environments.d.ts +1 -1
  15. package/dist/environments.js +1 -1
  16. package/dist/execute.d.ts +2 -2
  17. package/dist/execute.js +2 -2
  18. package/dist/index.d.ts +20 -30
  19. package/dist/index.js +9 -9
  20. package/dist/node.d.ts +22 -9
  21. package/dist/node.js +25 -15
  22. package/dist/path.js +4 -1
  23. package/dist/{reporters-MGvT5U9f.d.ts → reporters-fiIq_dT9.d.ts} +310 -148
  24. package/dist/reporters.d.ts +1 -1
  25. package/dist/reporters.js +8 -8
  26. package/dist/runners.d.ts +4 -2
  27. package/dist/runners.js +103 -57
  28. package/dist/{suite-8WAe-urM.d.ts → suite-D4aoU9rI.d.ts} +1 -1
  29. package/dist/suite.d.ts +2 -2
  30. package/dist/suite.js +2 -2
  31. package/dist/utils.d.ts +1 -5
  32. package/dist/utils.js +1 -6
  33. package/dist/vendor/{base.VFkIJ66g.js → base.C2DbLEfT.js} +4 -3
  34. package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
  35. package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.CMp8QfyL.js} +13 -14
  36. package/dist/vendor/{cac.DzKZaJu2.js → cac.BcJW7n2j.js} +127 -51
  37. package/dist/vendor/{cli-api.DTeni0Qq.js → cli-api.C8t8m4__.js} +2771 -1711
  38. package/dist/vendor/{constants.5SOfHUj0.js → constants.BWsVtsAj.js} +6 -22
  39. package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
  40. package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
  41. package/dist/vendor/{execute.CLLNVNnK.js → execute.T3gg2ZK6.js} +177 -63
  42. package/dist/vendor/{index.BfoZyXD1.js → index.-dbR4KUi.js} +17 -9
  43. package/dist/vendor/{index.CRxYS9H3.js → index.BC5zhX9y.js} +1201 -491
  44. package/dist/vendor/{index.DP-km6lF.js → index.BMmMjLIQ.js} +64 -51
  45. package/dist/vendor/{index._7XLd8Kd.js → index.C9Thslzw.js} +2 -1
  46. package/dist/vendor/{index.CmILuxzC.js → index.CQJ2m700.js} +3 -3
  47. package/dist/vendor/{index.DeR1hhfY.js → index.D4nqnQWz.js} +71 -74
  48. package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
  49. package/dist/vendor/{run-once.DLomgGUH.js → run-once.Db8Hgq9X.js} +2 -1
  50. package/dist/vendor/{setup-common.XeoZAW8t.js → setup-common.uqZOEWuR.js} +30 -15
  51. package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
  52. package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
  53. package/dist/vendor/{utils.D5gGkwyH.js → utils.DSO2UK15.js} +41 -26
  54. package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
  55. package/dist/vendor/{vi.ClD3hi7L.js → vi.BPjl8cAZ.js} +350 -166
  56. package/dist/vendor/{vm.Bi3bljci.js → vm.CycSoHnJ.js} +151 -86
  57. package/dist/worker.js +31 -15
  58. package/dist/workers/forks.js +4 -4
  59. package/dist/workers/runVmTests.js +14 -13
  60. package/dist/workers/threads.js +4 -4
  61. package/dist/workers/vmForks.js +6 -6
  62. package/dist/workers/vmThreads.js +6 -6
  63. package/dist/workers.d.ts +2 -2
  64. package/dist/workers.js +9 -9
  65. package/package.json +22 -22
  66. package/suppress-warnings.cjs +2 -4
package/LICENSE.md CHANGED
@@ -312,7 +312,7 @@ Repository: micromatch/braces
312
312
 
313
313
  > The MIT License (MIT)
314
314
  >
315
- > Copyright (c) 2014-2018, Jon Schlinkert.
315
+ > Copyright (c) 2014-present, Jon Schlinkert.
316
316
  >
317
317
  > Permission is hereby granted, free of charge, to any person obtaining a copy
318
318
  > of this software and associated documentation files (the "Software"), to deal
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { processError, startTests } from '@vitest/runner';
2
- import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-MGvT5U9f.js';
2
+ import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-fiIq_dT9.js';
3
3
  import { VitestExecutor } from './execute.js';
4
+ import * as spy$1 from '@vitest/spy';
4
5
  import 'vite';
5
6
  import 'vite-node';
6
7
  import '@vitest/snapshot';
@@ -17,6 +18,25 @@ import 'node:fs';
17
18
  import 'chai';
18
19
  import 'node:vm';
19
20
 
21
+ function _mergeNamespaces(n, m) {
22
+ m.forEach(function (e) {
23
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
24
+ if (k !== 'default' && !(k in n)) {
25
+ var d = Object.getOwnPropertyDescriptor(e, k);
26
+ Object.defineProperty(n, k, d.get ? d : {
27
+ enumerable: true,
28
+ get: function () { return e[k]; }
29
+ });
30
+ }
31
+ });
32
+ });
33
+ return Object.freeze(n);
34
+ }
35
+
36
+ var spy = /*#__PURE__*/_mergeNamespaces({
37
+ __proto__: null
38
+ }, [spy$1]);
39
+
20
40
  type Formatter = (input: string | number | null | undefined) => string;
21
41
 
22
42
  interface DiffOptions {
@@ -57,4 +77,4 @@ declare function startCoverageInsideWorker(options: CoverageOptions | undefined,
57
77
  declare function takeCoverageInsideWorker(options: CoverageOptions | undefined, loader: Loader): Promise<unknown>;
58
78
  declare function stopCoverageInsideWorker(options: CoverageOptions | undefined, loader: Loader): Promise<unknown>;
59
79
 
60
- export { getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
80
+ export { spy as SpyModule, getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
package/dist/browser.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export { processError, startTests } from '@vitest/runner';
2
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.XeoZAW8t.js';
3
- export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor/coverage.ChSqD-qS.js';
2
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.uqZOEWuR.js';
3
+ export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor/coverage.BhYSDdTT.js';
4
+ export { s as SpyModule } from './vendor/spy.Cf_4R5Oe.js';
4
5
  import '@vitest/utils';
5
6
  import '@vitest/snapshot';
6
- import './vendor/run-once.DLomgGUH.js';
7
+ import './vendor/run-once.Db8Hgq9X.js';
7
8
  import './vendor/global.7bFbnyXl.js';
9
+ import '@vitest/spy';
@@ -1,25 +1,25 @@
1
- import { g as globalApis } from '../vendor/constants.5SOfHUj0.js';
2
- import { V as VitestIndex } from '../vendor/index.CmILuxzC.js';
1
+ import { g as globalApis } from '../vendor/constants.BWsVtsAj.js';
2
+ import { V as VitestIndex } from '../vendor/index.CQJ2m700.js';
3
3
  import '@vitest/runner';
4
- import '../vendor/benchmark.BNLebNi5.js';
4
+ import '../vendor/benchmark.CMp8QfyL.js';
5
5
  import '@vitest/runner/utils';
6
6
  import '@vitest/utils';
7
- import '../vendor/index._7XLd8Kd.js';
7
+ import '../vendor/index.C9Thslzw.js';
8
8
  import 'pathe';
9
9
  import '../vendor/global.7bFbnyXl.js';
10
10
  import '../vendor/env.bmJgw1qP.js';
11
11
  import 'std-env';
12
- import '../vendor/run-once.DLomgGUH.js';
13
- import '../vendor/vi.ClD3hi7L.js';
12
+ import '../vendor/run-once.Db8Hgq9X.js';
13
+ import '../vendor/vi.BPjl8cAZ.js';
14
14
  import 'chai';
15
15
  import '../vendor/_commonjsHelpers.BFTU3MAI.js';
16
16
  import '@vitest/expect';
17
17
  import '@vitest/snapshot';
18
18
  import '@vitest/utils/error';
19
- import '../vendor/tasks.WC7M-K-v.js';
19
+ import '../vendor/tasks.DhVtQBtW.js';
20
20
  import '@vitest/utils/source-map';
21
- import '../vendor/base._gnK9Slw.js';
22
- import '../vendor/date.BKM1wewY.js';
21
+ import '../vendor/base.CTYV4Gnz.js';
22
+ import '../vendor/date.W2xKR2qe.js';
23
23
  import '@vitest/spy';
24
24
 
25
25
  function registerApiGlobally() {
@@ -18,8 +18,9 @@ class VitestGit {
18
18
  }
19
19
  async findChangedFiles(options) {
20
20
  const root = await this.getRoot(this.cwd);
21
- if (!root)
21
+ if (!root) {
22
22
  return null;
23
+ }
23
24
  this.root = root;
24
25
  const changedSince = options.changedSince;
25
26
  if (typeof changedSince === "string") {
@@ -37,24 +38,22 @@ class VitestGit {
37
38
  return [...staged, ...unstaged];
38
39
  }
39
40
  getFilesSince(hash) {
40
- return this.resolveFilesWithGitCommand(
41
- ["diff", "--name-only", `${hash}...HEAD`]
42
- );
41
+ return this.resolveFilesWithGitCommand([
42
+ "diff",
43
+ "--name-only",
44
+ `${hash}...HEAD`
45
+ ]);
43
46
  }
44
47
  getStagedFiles() {
45
- return this.resolveFilesWithGitCommand(
46
- ["diff", "--cached", "--name-only"]
47
- );
48
+ return this.resolveFilesWithGitCommand(["diff", "--cached", "--name-only"]);
48
49
  }
49
50
  getUnstagedFiles() {
50
- return this.resolveFilesWithGitCommand(
51
- [
52
- "ls-files",
53
- "--other",
54
- "--modified",
55
- "--exclude-standard"
56
- ]
57
- );
51
+ return this.resolveFilesWithGitCommand([
52
+ "ls-files",
53
+ "--other",
54
+ "--modified",
55
+ "--exclude-standard"
56
+ ]);
58
57
  }
59
58
  async getRoot(cwd) {
60
59
  const options = ["rev-parse", "--show-cdup"];
@@ -2,7 +2,7 @@ import { Writable } from 'node:stream';
2
2
  import { Console } from 'node:console';
3
3
  import { relative } from 'node:path';
4
4
  import { getSafeTimers, getColors } from '@vitest/utils';
5
- import { R as RealDate } from '../vendor/date.BKM1wewY.js';
5
+ import { R as RealDate } from '../vendor/date.W2xKR2qe.js';
6
6
  import 'pathe';
7
7
  import '@vitest/runner/utils';
8
8
  import { g as getWorkerState } from '../vendor/global.7bFbnyXl.js';
@@ -13,15 +13,18 @@ const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
13
13
  function getTaskIdByStack(root) {
14
14
  var _a, _b;
15
15
  const stack = (_a = new Error("STACK_TRACE_ERROR").stack) == null ? void 0 : _a.split("\n");
16
- if (!stack)
16
+ if (!stack) {
17
17
  return UNKNOWN_TEST_ID;
18
+ }
18
19
  const index = stack.findIndex((line2) => line2.includes("at Console.value"));
19
20
  const line = index === -1 ? null : stack[index + 2];
20
- if (!line)
21
+ if (!line) {
21
22
  return UNKNOWN_TEST_ID;
23
+ }
22
24
  const filepath = (_b = line.match(/at\s(.*)\s?/)) == null ? void 0 : _b[1];
23
- if (filepath)
25
+ if (filepath) {
24
26
  return relative(root, filepath);
27
+ }
25
28
  return UNKNOWN_TEST_ID;
26
29
  }
27
30
  function createCustomConsole(defaultState) {
@@ -45,36 +48,44 @@ function createCustomConsole(defaultState) {
45
48
  });
46
49
  }
47
50
  function sendStdout(taskId) {
48
- const buffer = stdoutBuffer.get(taskId);
49
- if (!buffer)
50
- return;
51
- const content = buffer.map((i) => String(i)).join("");
52
- const timer = timers.get(taskId);
53
- state().rpc.onUserConsoleLog({
54
- type: "stdout",
55
- content: content || "<empty line>",
56
- taskId,
57
- time: timer.stdoutTime || RealDate.now(),
58
- size: buffer.length
59
- });
60
- stdoutBuffer.set(taskId, []);
61
- timer.stdoutTime = 0;
51
+ sendBuffer("stdout", taskId);
62
52
  }
63
53
  function sendStderr(taskId) {
64
- const buffer = stderrBuffer.get(taskId);
65
- if (!buffer)
54
+ sendBuffer("stderr", taskId);
55
+ }
56
+ function sendBuffer(type, taskId) {
57
+ const buffers = type === "stdout" ? stdoutBuffer : stderrBuffer;
58
+ const buffer = buffers.get(taskId);
59
+ if (!buffer) {
66
60
  return;
67
- const content = buffer.map((i) => String(i)).join("");
61
+ }
62
+ if (state().config.printConsoleTrace) {
63
+ buffer.forEach(([buffer2, origin]) => {
64
+ sendLog(type, taskId, String(buffer2), buffer2.length, origin);
65
+ });
66
+ } else {
67
+ const content = buffer.map((i) => String(i[0])).join("");
68
+ sendLog(type, taskId, content, buffer.length);
69
+ }
70
+ const timer = timers.get(taskId);
71
+ buffers.set(taskId, []);
72
+ if (type === "stderr") {
73
+ timer.stderrTime = 0;
74
+ } else {
75
+ timer.stdoutTime = 0;
76
+ }
77
+ }
78
+ function sendLog(type, taskId, content, size, origin) {
68
79
  const timer = timers.get(taskId);
80
+ const time = type === "stderr" ? timer.stderrTime : timer.stdoutTime;
69
81
  state().rpc.onUserConsoleLog({
70
- type: "stderr",
82
+ type,
71
83
  content: content || "<empty line>",
72
84
  taskId,
73
- time: timer.stderrTime || RealDate.now(),
74
- size: buffer.length
85
+ time: time || RealDate.now(),
86
+ size,
87
+ origin
75
88
  });
76
- stderrBuffer.set(taskId, []);
77
- timer.stderrTime = 0;
78
89
  }
79
90
  const stdout = new Writable({
80
91
  write(data, encoding, callback) {
@@ -85,7 +96,11 @@ function createCustomConsole(defaultState) {
85
96
  if (timer) {
86
97
  timer.stdoutTime = timer.stdoutTime || RealDate.now();
87
98
  } else {
88
- timer = { stdoutTime: RealDate.now(), stderrTime: RealDate.now(), timer: 0 };
99
+ timer = {
100
+ stdoutTime: RealDate.now(),
101
+ stderrTime: RealDate.now(),
102
+ timer: 0
103
+ };
89
104
  timers.set(id, timer);
90
105
  }
91
106
  let buffer = stdoutBuffer.get(id);
@@ -93,21 +108,34 @@ function createCustomConsole(defaultState) {
93
108
  buffer = [];
94
109
  stdoutBuffer.set(id, buffer);
95
110
  }
96
- buffer.push(data);
111
+ if (state().config.printConsoleTrace) {
112
+ const limit = Error.stackTraceLimit;
113
+ Error.stackTraceLimit = limit + 6;
114
+ const stack = new Error("STACK_TRACE").stack;
115
+ const trace = stack == null ? void 0 : stack.split("\n").slice(7).join("\n");
116
+ Error.stackTraceLimit = limit;
117
+ buffer.push([data, trace]);
118
+ } else {
119
+ buffer.push([data, void 0]);
120
+ }
97
121
  schedule(id);
98
122
  callback();
99
123
  }
100
124
  });
101
125
  const stderr = new Writable({
102
126
  write(data, encoding, callback) {
103
- var _a, _b, _c, _d;
127
+ var _a, _b, _c, _d, _e;
104
128
  const s = state();
105
129
  const id = ((_a = s == null ? void 0 : s.current) == null ? void 0 : _a.id) || ((_c = (_b = s == null ? void 0 : s.current) == null ? void 0 : _b.suite) == null ? void 0 : _c.id) || ((_d = s.current) == null ? void 0 : _d.file.id) || getTaskIdByStack(s.config.root);
106
130
  let timer = timers.get(id);
107
131
  if (timer) {
108
132
  timer.stderrTime = timer.stderrTime || RealDate.now();
109
133
  } else {
110
- timer = { stderrTime: RealDate.now(), stdoutTime: RealDate.now(), timer: 0 };
134
+ timer = {
135
+ stderrTime: RealDate.now(),
136
+ stdoutTime: RealDate.now(),
137
+ timer: 0
138
+ };
111
139
  timers.set(id, timer);
112
140
  }
113
141
  let buffer = stderrBuffer.get(id);
@@ -115,7 +143,24 @@ function createCustomConsole(defaultState) {
115
143
  buffer = [];
116
144
  stderrBuffer.set(id, buffer);
117
145
  }
118
- buffer.push(data);
146
+ if (state().config.printConsoleTrace) {
147
+ const limit = Error.stackTraceLimit;
148
+ Error.stackTraceLimit = limit + 6;
149
+ const stack = (_e = new Error("STACK_TRACE").stack) == null ? void 0 : _e.split("\n");
150
+ Error.stackTraceLimit = limit;
151
+ const isTrace = stack == null ? void 0 : stack.some(
152
+ (line) => line.includes("at Console.trace")
153
+ );
154
+ if (isTrace) {
155
+ buffer.push([data, void 0]);
156
+ } else {
157
+ const trace = stack == null ? void 0 : stack.slice(7).join("\n");
158
+ Error.stackTraceLimit = limit;
159
+ buffer.push([data, trace]);
160
+ }
161
+ } else {
162
+ buffer.push([data, void 0]);
163
+ }
119
164
  schedule(id);
120
165
  callback();
121
166
  }
@@ -5,16 +5,16 @@ import '@vitest/runner/utils';
5
5
  import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
6
6
  import { g as getWorkerState } from '../vendor/global.7bFbnyXl.js';
7
7
  import '../vendor/env.bmJgw1qP.js';
8
- import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.ClD3hi7L.js';
9
- import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.ChSqD-qS.js';
10
- import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.BfoZyXD1.js';
8
+ import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.BPjl8cAZ.js';
9
+ import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.BhYSDdTT.js';
10
+ import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.-dbR4KUi.js';
11
11
  import { createRequire } from 'node:module';
12
12
  import util from 'node:util';
13
13
  import timers from 'node:timers';
14
14
  import { isatty } from 'node:tty';
15
15
  import { installSourcemapsSupport } from 'vite-node/source-map';
16
- import { V as VitestIndex } from '../vendor/index.CmILuxzC.js';
17
- import { s as setupCommonEnv } from '../vendor/setup-common.XeoZAW8t.js';
16
+ import { V as VitestIndex } from '../vendor/index.CQJ2m700.js';
17
+ import { s as setupCommonEnv } from '../vendor/setup-common.uqZOEWuR.js';
18
18
  import { c as closeInspector } from '../vendor/inspector.hPQncR7V.js';
19
19
  import 'std-env';
20
20
  import 'chai';
@@ -22,18 +22,18 @@ import '../vendor/_commonjsHelpers.BFTU3MAI.js';
22
22
  import '@vitest/expect';
23
23
  import '@vitest/snapshot';
24
24
  import '@vitest/utils/error';
25
- import '../vendor/tasks.WC7M-K-v.js';
25
+ import '../vendor/tasks.DhVtQBtW.js';
26
26
  import '@vitest/utils/source-map';
27
- import '../vendor/base._gnK9Slw.js';
28
- import '../vendor/date.BKM1wewY.js';
27
+ import '../vendor/base.CTYV4Gnz.js';
28
+ import '../vendor/date.W2xKR2qe.js';
29
29
  import '@vitest/spy';
30
30
  import '../path.js';
31
31
  import 'node:url';
32
- import '../vendor/rpc.DRDE9Pu1.js';
32
+ import '../vendor/rpc.BGx7q_k2.js';
33
33
  import '../vendor/index.BpSiYbpB.js';
34
- import '../vendor/benchmark.BNLebNi5.js';
35
- import '../vendor/index._7XLd8Kd.js';
36
- import '../vendor/run-once.DLomgGUH.js';
34
+ import '../vendor/benchmark.CMp8QfyL.js';
35
+ import '../vendor/index.C9Thslzw.js';
36
+ import '../vendor/run-once.Db8Hgq9X.js';
37
37
 
38
38
  let globalSetup = false;
39
39
  async function setupGlobalEnv(config, { environment }, executor) {
@@ -43,10 +43,12 @@ async function setupGlobalEnv(config, { environment }, executor) {
43
43
  enumerable: false
44
44
  });
45
45
  const state = getWorkerState();
46
- if (!state.config.snapshotOptions.snapshotEnvironment)
46
+ if (!state.config.snapshotOptions.snapshotEnvironment) {
47
47
  state.config.snapshotOptions.snapshotEnvironment = await resolveSnapshotEnvironment(config, executor);
48
- if (globalSetup)
48
+ }
49
+ if (globalSetup) {
49
50
  return;
51
+ }
50
52
  globalSetup = true;
51
53
  setupColors(createColors(isatty(1)));
52
54
  if (environment.transformMode === "web") {
@@ -66,11 +68,12 @@ async function setupGlobalEnv(config, { environment }, executor) {
66
68
  installSourcemapsSupport({
67
69
  getSourceMap: (source) => state.moduleCache.getSourceMap(source)
68
70
  });
69
- if (!config.disableConsoleIntercept)
71
+ if (!config.disableConsoleIntercept) {
70
72
  await setupConsoleLogSpy();
73
+ }
71
74
  }
72
75
  async function setupConsoleLogSpy() {
73
- const { createCustomConsole } = await import('./runtime-console.CUES-L8X.js');
76
+ const { createCustomConsole } = await import('./runtime-console.Ckl0vEQr.js');
74
77
  globalThis.console = createCustomConsole();
75
78
  }
76
79
  async function withEnv({ environment }, options, fn) {
@@ -92,8 +95,9 @@ async function run(files, config, environment, executor) {
92
95
  const workerState = getWorkerState();
93
96
  await setupGlobalEnv(config, environment, executor);
94
97
  await startCoverageInsideWorker(config.coverage, executor);
95
- if (config.chaiConfig)
98
+ if (config.chaiConfig) {
96
99
  setupChaiConfig(config.chaiConfig);
100
+ }
97
101
  const runner = await resolveTestRunner(config, executor);
98
102
  workerState.onCancel.then((reason) => {
99
103
  var _a;
@@ -102,23 +106,27 @@ async function run(files, config, environment, executor) {
102
106
  });
103
107
  workerState.durations.prepare = performance.now() - workerState.durations.prepare;
104
108
  workerState.durations.environment = performance.now();
105
- await withEnv(environment, environment.options || config.environmentOptions || {}, async () => {
106
- var _a, _b, _c, _d;
107
- workerState.durations.environment = performance.now() - workerState.durations.environment;
108
- for (const file of files) {
109
- const isIsolatedThreads = config.pool === "threads" && (((_b = (_a = config.poolOptions) == null ? void 0 : _a.threads) == null ? void 0 : _b.isolate) ?? true);
110
- const isIsolatedForks = config.pool === "forks" && (((_d = (_c = config.poolOptions) == null ? void 0 : _c.forks) == null ? void 0 : _d.isolate) ?? true);
111
- if (isIsolatedThreads || isIsolatedForks) {
112
- workerState.mockMap.clear();
113
- resetModules(workerState.moduleCache, true);
109
+ await withEnv(
110
+ environment,
111
+ environment.options || config.environmentOptions || {},
112
+ async () => {
113
+ var _a, _b, _c, _d;
114
+ workerState.durations.environment = performance.now() - workerState.durations.environment;
115
+ for (const file of files) {
116
+ const isIsolatedThreads = config.pool === "threads" && (((_b = (_a = config.poolOptions) == null ? void 0 : _a.threads) == null ? void 0 : _b.isolate) ?? true);
117
+ const isIsolatedForks = config.pool === "forks" && (((_d = (_c = config.poolOptions) == null ? void 0 : _c.forks) == null ? void 0 : _d.isolate) ?? true);
118
+ if (isIsolatedThreads || isIsolatedForks) {
119
+ workerState.mockMap.clear();
120
+ resetModules(workerState.moduleCache, true);
121
+ }
122
+ workerState.filepath = file;
123
+ await startTests([file], runner);
124
+ vi.resetConfig();
125
+ vi.restoreAllMocks();
114
126
  }
115
- workerState.filepath = file;
116
- await startTests([file], runner);
117
- vi.resetConfig();
118
- vi.restoreAllMocks();
127
+ await stopCoverageInsideWorker(config.coverage, executor);
119
128
  }
120
- await stopCoverageInsideWorker(config.coverage, executor);
121
- });
129
+ );
122
130
  workerState.environmentTeardownRun = true;
123
131
  }
124
132
 
package/dist/cli.js CHANGED
@@ -1,9 +1,9 @@
1
- import { c as createCLI } from './vendor/cac.DzKZaJu2.js';
1
+ import { c as createCLI } from './vendor/cac.BcJW7n2j.js';
2
2
  import 'pathe';
3
3
  import 'events';
4
4
  import 'picocolors';
5
- import './vendor/base._gnK9Slw.js';
5
+ import './vendor/base.CTYV4Gnz.js';
6
6
  import '@vitest/utils';
7
- import './vendor/constants.5SOfHUj0.js';
7
+ import './vendor/constants.BWsVtsAj.js';
8
8
 
9
9
  createCLI().parse();
package/dist/config.cjs CHANGED
@@ -8,9 +8,25 @@ var _a$1;
8
8
  const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
9
9
  isNode && process.platform === "win32";
10
10
 
11
+ const defaultBrowserPort = 63315;
12
+ const extraInlineDeps = [
13
+ /^(?!.*node_modules).*\.mjs$/,
14
+ /^(?!.*node_modules).*\.cjs\.js$/,
15
+ // Vite client
16
+ /vite\w*\/dist\/client\/env.mjs/,
17
+ // Nuxt
18
+ "@nuxt/test-utils"
19
+ ];
20
+
11
21
  var _a, _b;
12
22
  const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
13
- const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"];
23
+ const defaultExclude = [
24
+ "**/node_modules/**",
25
+ "**/dist/**",
26
+ "**/cypress/**",
27
+ "**/.{idea,git,cache,output,temp}/**",
28
+ "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"
29
+ ];
14
30
  const defaultCoverageExcludes = [
15
31
  "coverage/**",
16
32
  "dist/**",
@@ -38,11 +54,31 @@ const coverageConfigDefaults = {
38
54
  reportsDirectory: "./coverage",
39
55
  exclude: defaultCoverageExcludes,
40
56
  reportOnFailure: false,
41
- reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
42
- extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
57
+ reporter: [
58
+ ["text", {}],
59
+ ["html", {}],
60
+ ["clover", {}],
61
+ ["json", {}]
62
+ ],
63
+ extension: [
64
+ ".js",
65
+ ".cjs",
66
+ ".mjs",
67
+ ".ts",
68
+ ".mts",
69
+ ".cts",
70
+ ".tsx",
71
+ ".jsx",
72
+ ".vue",
73
+ ".svelte",
74
+ ".marko"
75
+ ],
43
76
  allowExternal: false,
44
77
  ignoreEmptyLines: true,
45
- processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
78
+ processingConcurrency: Math.min(
79
+ 20,
80
+ ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length
81
+ )
46
82
  };
47
83
  const fakeTimersDefaults = {
48
84
  loopLimit: 1e4,
@@ -63,19 +99,14 @@ const config = {
63
99
  watch: !stdEnv.isCI,
64
100
  globals: false,
65
101
  environment: "node",
66
- pool: "threads",
102
+ pool: "forks",
67
103
  clearMocks: false,
68
104
  restoreMocks: false,
69
105
  mockReset: false,
70
106
  include: defaultInclude,
71
107
  exclude: defaultExclude,
72
- testTimeout: 5e3,
73
- hookTimeout: 1e4,
74
108
  teardownTimeout: 1e4,
75
- forceRerunTriggers: [
76
- "**/package.json/**",
77
- "**/{vitest,vite}.config.*/**"
78
- ],
109
+ forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
79
110
  update: false,
80
111
  reporters: [],
81
112
  silent: false,
@@ -101,15 +132,6 @@ const config = {
101
132
  };
102
133
  const configDefaults = Object.freeze(config);
103
134
 
104
- const extraInlineDeps = [
105
- /^(?!.*(?:node_modules)).*\.mjs$/,
106
- /^(?!.*(?:node_modules)).*\.cjs\.js$/,
107
- // Vite client
108
- /vite\w*\/dist\/client\/env.mjs/,
109
- // Nuxt
110
- "@nuxt/test-utils"
111
- ];
112
-
113
135
  function defineConfig(config) {
114
136
  return config;
115
137
  }
@@ -126,6 +148,7 @@ Object.defineProperty(exports, "mergeConfig", {
126
148
  });
127
149
  exports.configDefaults = configDefaults;
128
150
  exports.coverageConfigDefaults = coverageConfigDefaults;
151
+ exports.defaultBrowserPort = defaultBrowserPort;
129
152
  exports.defaultExclude = defaultExclude;
130
153
  exports.defaultInclude = defaultInclude;
131
154
  exports.defineConfig = defineConfig;
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
2
- export { ax as UserConfigExport, aw as UserConfigFn, au as UserConfigFnObject, av as UserConfigFnPromise, az as UserProjectConfigExport, ay as UserProjectConfigFn, a1 as UserWorkspaceConfig, aD as configDefaults, aG as coverageConfigDefaults, aF as defaultExclude, aE as defaultInclude, aA as defineConfig, aB as defineProject, aC as defineWorkspace, aH as extraInlineDeps } from './reporters-MGvT5U9f.js';
1
+ export { ConfigEnv, Plugin, UserConfig, mergeConfig } from 'vite';
2
+ export { aM as UserConfigExport, aL as UserConfigFn, aJ as UserConfigFnObject, aK as UserConfigFnPromise, aO as UserProjectConfigExport, aN as UserProjectConfigFn, K as UserWorkspaceConfig, aT as configDefaults, aW as coverageConfigDefaults, aS as defaultBrowserPort, aV as defaultExclude, aU as defaultInclude, aP as defineConfig, aQ as defineProject, aR as defineWorkspace, aX as extraInlineDeps } from './reporters-fiIq_dT9.js';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
5
5
  import '@vitest/snapshot';