vitest 2.0.0-beta.9 → 2.0.1

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 (73) hide show
  1. package/LICENSE.md +1 -22
  2. package/dist/browser.d.ts +24 -7
  3. package/dist/browser.js +5 -19
  4. package/dist/chunks/browser-creator.DSqYDthP.js +673 -0
  5. package/dist/chunks/{environments-node.39w4gmlF.js → environments-node.XE5FbRPQ.js} +1 -1
  6. package/dist/chunks/{integrations-globals.BK0Cn4q1.js → integrations-globals.CzYWb38r.js} +10 -9
  7. package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
  8. package/dist/chunks/{runtime-console.DiVMr5d4.js → runtime-console.O41g23Zj.js} +26 -11
  9. package/dist/chunks/{runtime-runBaseTests.C-Bkopka.js → runtime-runBaseTests.DX3h28Mp.js} +47 -34
  10. package/dist/cli.js +3 -3
  11. package/dist/config.cjs +48 -23
  12. package/dist/config.d.ts +2 -1
  13. package/dist/config.js +48 -24
  14. package/dist/coverage.d.ts +6 -4
  15. package/dist/coverage.js +102 -38
  16. package/dist/environments.d.ts +2 -1
  17. package/dist/environments.js +1 -1
  18. package/dist/execute.d.ts +4 -3
  19. package/dist/execute.js +2 -2
  20. package/dist/index.d.ts +1437 -7
  21. package/dist/index.js +10 -9
  22. package/dist/node.d.ts +34 -7
  23. package/dist/node.js +31 -20
  24. package/dist/path.js +4 -1
  25. package/dist/{reporters-DaDey3o0.d.ts → reporters-BU_vXAUX.d.ts} +216 -206
  26. package/dist/reporters.d.ts +2 -1
  27. package/dist/reporters.js +8 -8
  28. package/dist/runners.d.ts +3 -1
  29. package/dist/runners.js +100 -61
  30. package/dist/snapshot.js +2 -2
  31. package/dist/{suite-BHSUxUib.d.ts → suite-BRl_IYuM.d.ts} +1 -1
  32. package/dist/suite.d.ts +3 -2
  33. package/dist/suite.js +3 -3
  34. package/dist/utils.d.ts +1 -5
  35. package/dist/utils.js +1 -6
  36. package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
  37. package/dist/vendor/{base.D4XK-wRp.js → base.CdA1i5tB.js} +6 -4
  38. package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.B6pblCp2.js} +13 -14
  39. package/dist/vendor/{cac.DCg3FnEs.js → cac.BQc6bsef.js} +142 -47
  40. package/dist/vendor/{cli-api.LMvYagQ5.js → cli-api.BGRtK_Kj.js} +4189 -9537
  41. package/dist/vendor/{constants.TCjCaw2D.js → constants.CsnA4eRy.js} +5 -23
  42. package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
  43. package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
  44. package/dist/vendor/env.2ltrQNq0.js +8 -0
  45. package/dist/vendor/{execute.BHj6OMh4.js → execute.Dx503nGn.js} +186 -64
  46. package/dist/vendor/{index.TBU3GqRP.js → index.3x3MdmUV.js} +1075 -526
  47. package/dist/vendor/{index._7XLd8Kd.js → index.BJmtb_7W.js} +3 -2
  48. package/dist/vendor/{index.DP-km6lF.js → index.BMmMjLIQ.js} +64 -51
  49. package/dist/vendor/{index.DHRpy7zp.js → index.CROIsoiT.js} +18 -10
  50. package/dist/vendor/{index.DeR1hhfY.js → index.D4nqnQWz.js} +71 -74
  51. package/dist/vendor/index.D6GZqexG.js +6575 -0
  52. package/dist/vendor/{index.DwR86H5i.js → index.Hqvcg1pf.js} +4 -27
  53. package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
  54. package/dist/vendor/run-once.Db8Hgq9X.js +28 -0
  55. package/dist/vendor/{setup-common.BhJvzjns.js → setup-common.yHaxjRhz.js} +30 -15
  56. package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
  57. package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
  58. package/dist/vendor/{utils.YuQ3LT2a.js → utils.BVMrsl6E.js} +55 -30
  59. package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
  60. package/dist/vendor/{vi.C6AfDXK6.js → vi.DXACdGTu.js} +269 -136
  61. package/dist/vendor/{vm.Ow-X2mkS.js → vm.BrDS6p7h.js} +157 -90
  62. package/dist/worker.js +41 -18
  63. package/dist/workers/forks.js +12 -6
  64. package/dist/workers/runVmTests.js +22 -16
  65. package/dist/workers/threads.js +8 -5
  66. package/dist/workers/vmForks.js +15 -9
  67. package/dist/workers/vmThreads.js +11 -8
  68. package/dist/workers.d.ts +8 -5
  69. package/dist/workers.js +11 -11
  70. package/package.json +22 -21
  71. package/suppress-warnings.cjs +2 -4
  72. package/dist/index-B0dCycbN.d.ts +0 -1571
  73. package/dist/vendor/env.bmJgw1qP.js +0 -7
@@ -1,34 +1,11 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
2
- import { b as bench } from './benchmark.BNLebNi5.js';
2
+ import { b as bench } from './benchmark.B6pblCp2.js';
3
+ import { i as isFirstRun, a as runOnce } from './run-once.Db8Hgq9X.js';
4
+ import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.DXACdGTu.js';
3
5
  import { g as getWorkerState } from './global.7bFbnyXl.js';
4
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.C6AfDXK6.js';
5
6
  import * as chai from 'chai';
6
7
  import { assert, should } from 'chai';
7
8
 
8
- const filesCount = /* @__PURE__ */ new Map();
9
- const cache = /* @__PURE__ */ new Map();
10
- function runOnce(fn, key) {
11
- const filepath = getWorkerState().filepath || "__unknown_files__";
12
- if (!key) {
13
- filesCount.set(filepath, (filesCount.get(filepath) || 0) + 1);
14
- key = String(filesCount.get(filepath));
15
- }
16
- const id = `${filepath}:${key}`;
17
- if (!cache.has(id))
18
- cache.set(id, fn());
19
- return cache.get(id);
20
- }
21
- function isFirstRun() {
22
- let firstRun = false;
23
- runOnce(() => {
24
- firstRun = true;
25
- }, "__vitest_first_run__");
26
- return firstRun;
27
- }
28
- function resetRunOnceCounter() {
29
- filesCount.clear();
30
- }
31
-
32
9
  function getRunningMode() {
33
10
  return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
34
11
  }
@@ -151,4 +128,4 @@ var VitestIndex = /*#__PURE__*/Object.freeze({
151
128
  vitest: vitest
152
129
  });
153
130
 
154
- export { VitestIndex as V, runOnce as a, inject as b, isWatchMode as c, dist as d, assertType as e, getRunningMode as g, isFirstRun as i, resetRunOnceCounter as r };
131
+ export { VitestIndex as V, isWatchMode as a, assertType as b, dist as d, getRunningMode as g, inject as i };
@@ -16,8 +16,9 @@ function withSafeTimers(fn) {
16
16
  globalThis.clearTimeout = clearTimeout;
17
17
  globalThis.setImmediate = setImmediate;
18
18
  globalThis.clearImmediate = clearImmediate;
19
- if (globalThis.process)
19
+ if (globalThis.process) {
20
20
  globalThis.process.nextTick = nextTick;
21
+ }
21
22
  const result = fn();
22
23
  return result;
23
24
  } finally {
@@ -34,8 +35,9 @@ function withSafeTimers(fn) {
34
35
  }
35
36
  const promises = /* @__PURE__ */ new Set();
36
37
  async function rpcDone() {
37
- if (!promises.size)
38
+ if (!promises.size) {
38
39
  return;
40
+ }
39
41
  const awaitable = Array.from(promises);
40
42
  return Promise.all(awaitable);
41
43
  }
@@ -45,24 +47,33 @@ function createRuntimeRpc(options) {
45
47
  const onCancel = new Promise((resolve) => {
46
48
  setCancel = resolve;
47
49
  });
48
- const rpc2 = createSafeRpc(createBirpc(
49
- {
50
- onCancel: setCancel
51
- },
52
- {
53
- eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onCancel"],
54
- onTimeoutError(functionName, args) {
55
- var _a;
56
- let message = `[vitest-worker]: Timeout calling "${functionName}"`;
57
- if (functionName === "fetch" || functionName === "transform" || functionName === "resolveId")
58
- message += ` with "${JSON.stringify(args)}"`;
59
- if (functionName === "onUnhandledError")
60
- message += ` with "${((_a = args[0]) == null ? void 0 : _a.message) || args[0]}"`;
61
- throw new Error(message);
50
+ const rpc2 = createSafeRpc(
51
+ createBirpc(
52
+ {
53
+ onCancel: setCancel
62
54
  },
63
- ...options
64
- }
65
- ));
55
+ {
56
+ eventNames: [
57
+ "onUserConsoleLog",
58
+ "onFinished",
59
+ "onCollected",
60
+ "onCancel"
61
+ ],
62
+ onTimeoutError(functionName, args) {
63
+ var _a;
64
+ let message = `[vitest-worker]: Timeout calling "${functionName}"`;
65
+ if (functionName === "fetch" || functionName === "transform" || functionName === "resolveId") {
66
+ message += ` with "${JSON.stringify(args)}"`;
67
+ }
68
+ if (functionName === "onUnhandledError") {
69
+ message += ` with "${((_a = args[0]) == null ? void 0 : _a.message) || args[0]}"`;
70
+ }
71
+ throw new Error(message);
72
+ },
73
+ ...options
74
+ }
75
+ )
76
+ );
66
77
  return {
67
78
  rpc: rpc2,
68
79
  onCancel
@@ -0,0 +1,28 @@
1
+ import { g as getWorkerState } from './global.7bFbnyXl.js';
2
+
3
+ const filesCount = /* @__PURE__ */ new Map();
4
+ const cache = /* @__PURE__ */ new Map();
5
+ function runOnce(fn, key) {
6
+ const filepath = getWorkerState().filepath || "__unknown_files__";
7
+ if (!key) {
8
+ filesCount.set(filepath, (filesCount.get(filepath) || 0) + 1);
9
+ key = String(filesCount.get(filepath));
10
+ }
11
+ const id = `${filepath}:${key}`;
12
+ if (!cache.has(id)) {
13
+ cache.set(id, fn());
14
+ }
15
+ return cache.get(id);
16
+ }
17
+ function isFirstRun() {
18
+ let firstRun = false;
19
+ runOnce(() => {
20
+ firstRun = true;
21
+ }, "__vitest_first_run__");
22
+ return firstRun;
23
+ }
24
+ function resetRunOnceCounter() {
25
+ filesCount.clear();
26
+ }
27
+
28
+ export { runOnce as a, isFirstRun as i, resetRunOnceCounter as r };
@@ -1,51 +1,66 @@
1
1
  import { setSafeTimers } from '@vitest/utils';
2
2
  import { addSerializer } from '@vitest/snapshot';
3
- import { r as resetRunOnceCounter } from './index.DwR86H5i.js';
3
+ import { r as resetRunOnceCounter } from './run-once.Db8Hgq9X.js';
4
4
 
5
5
  let globalSetup = false;
6
6
  async function setupCommonEnv(config) {
7
7
  resetRunOnceCounter();
8
8
  setupDefines(config.defines);
9
9
  setupEnv(config.env);
10
- if (globalSetup)
10
+ if (globalSetup) {
11
11
  return;
12
+ }
12
13
  globalSetup = true;
13
14
  setSafeTimers();
14
- if (config.globals)
15
- (await import('../chunks/integrations-globals.BK0Cn4q1.js')).registerApiGlobally();
15
+ if (config.globals) {
16
+ (await import('../chunks/integrations-globals.CzYWb38r.js')).registerApiGlobally();
17
+ }
16
18
  }
17
19
  function setupDefines(defines) {
18
- for (const key in defines)
20
+ for (const key in defines) {
19
21
  globalThis[key] = defines[key];
22
+ }
20
23
  }
21
24
  function setupEnv(env) {
22
- if (typeof process === "undefined")
25
+ if (typeof process === "undefined") {
23
26
  return;
27
+ }
24
28
  const { PROD, DEV, ...restEnvs } = env;
25
29
  process.env.PROD = PROD ? "1" : "";
26
30
  process.env.DEV = DEV ? "1" : "";
27
- for (const key in restEnvs)
31
+ for (const key in restEnvs) {
28
32
  process.env[key] = env[key];
33
+ }
29
34
  }
30
35
  async function loadDiffConfig(config, executor) {
31
- if (typeof config.diff !== "string")
36
+ if (typeof config.diff !== "string") {
32
37
  return;
38
+ }
33
39
  const diffModule = await executor.executeId(config.diff);
34
- if (diffModule && typeof diffModule.default === "object" && diffModule.default != null)
40
+ if (diffModule && typeof diffModule.default === "object" && diffModule.default != null) {
35
41
  return diffModule.default;
36
- else
37
- throw new Error(`invalid diff config file ${config.diff}. Must have a default export with config object`);
42
+ } else {
43
+ throw new Error(
44
+ `invalid diff config file ${config.diff}. Must have a default export with config object`
45
+ );
46
+ }
38
47
  }
39
48
  async function loadSnapshotSerializers(config, executor) {
40
49
  const files = config.snapshotSerializers;
41
50
  const snapshotSerializers = await Promise.all(
42
51
  files.map(async (file) => {
43
52
  const mo = await executor.executeId(file);
44
- if (!mo || typeof mo.default !== "object" || mo.default === null)
45
- throw new Error(`invalid snapshot serializer file ${file}. Must export a default object`);
53
+ if (!mo || typeof mo.default !== "object" || mo.default === null) {
54
+ throw new Error(
55
+ `invalid snapshot serializer file ${file}. Must export a default object`
56
+ );
57
+ }
46
58
  const config2 = mo.default;
47
- if (typeof config2.test !== "function" || typeof config2.serialize !== "function" && typeof config2.print !== "function")
48
- throw new Error(`invalid snapshot serializer in ${file}. Must have a 'test' method along with either a 'serialize' or 'print' method.`);
59
+ if (typeof config2.test !== "function" || typeof config2.serialize !== "function" && typeof config2.print !== "function") {
60
+ throw new TypeError(
61
+ `invalid snapshot serializer in ${file}. Must have a 'test' method along with either a 'serialize' or 'print' method.`
62
+ );
63
+ }
49
64
  return config2;
50
65
  })
51
66
  );
@@ -0,0 +1,22 @@
1
+ import * as spy$1 from '@vitest/spy';
2
+
3
+ function _mergeNamespaces(n, m) {
4
+ m.forEach(function (e) {
5
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6
+ if (k !== 'default' && !(k in n)) {
7
+ var d = Object.getOwnPropertyDescriptor(e, k);
8
+ Object.defineProperty(n, k, d.get ? d : {
9
+ enumerable: true,
10
+ get: function () { return e[k]; }
11
+ });
12
+ }
13
+ });
14
+ });
15
+ return Object.freeze(n);
16
+ }
17
+
18
+ var spy = /*#__PURE__*/_mergeNamespaces({
19
+ __proto__: null
20
+ }, [spy$1]);
21
+
22
+ export { spy as s };
@@ -4,7 +4,9 @@ import '@vitest/utils';
4
4
  function hasFailedSnapshot(suite) {
5
5
  return getTests(suite).some((s) => {
6
6
  var _a, _b;
7
- return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some((e) => typeof (e == null ? void 0 : e.message) === "string" && e.message.match(/Snapshot .* mismatched/));
7
+ return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some(
8
+ (e) => typeof (e == null ? void 0 : e.message) === "string" && e.message.match(/Snapshot .* mismatched/)
9
+ );
8
10
  });
9
11
  }
10
12
  function getFullName(task, separator = " > ") {
@@ -1,6 +1,6 @@
1
1
  import { isAbsolute, relative, dirname, basename } from 'pathe';
2
2
  import c from 'picocolors';
3
- import { a as slash } from './base._gnK9Slw.js';
3
+ import { a as slash } from './base.CTYV4Gnz.js';
4
4
 
5
5
  const F_RIGHT = "\u2192";
6
6
  const F_DOWN = "\u2193";
@@ -37,11 +37,17 @@ const spinnerMap = /* @__PURE__ */ new WeakMap();
37
37
  const hookSpinnerMap = /* @__PURE__ */ new WeakMap();
38
38
  const pointer = c.yellow(F_POINTER);
39
39
  const skipped = c.dim(c.gray(F_DOWN));
40
+ const benchmarkPass = c.green(F_DOT);
41
+ const testPass = c.green(F_CHECK);
42
+ const taskFail = c.red(F_CROSS);
43
+ const suiteFail = c.red(F_POINTER);
44
+ const pending = c.gray("\xB7");
40
45
  function getCols(delta = 0) {
41
46
  var _a;
42
47
  let length = (_a = process.stdout) == null ? void 0 : _a.columns;
43
- if (!length || Number.isNaN(length))
48
+ if (!length || Number.isNaN(length)) {
44
49
  length = 30;
50
+ }
45
51
  return Math.max(length + delta, 0);
46
52
  }
47
53
  function divider(text, left, right) {
@@ -62,8 +68,9 @@ function divider(text, left, right) {
62
68
  }
63
69
  function formatTestPath(root, path) {
64
70
  var _a;
65
- if (isAbsolute(path))
71
+ if (isAbsolute(path)) {
66
72
  path = relative(root, path);
73
+ }
67
74
  const dir = dirname(path);
68
75
  const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
69
76
  const base = basename(path, ext);
@@ -71,17 +78,23 @@ function formatTestPath(root, path) {
71
78
  }
72
79
  function renderSnapshotSummary(rootDir, snapshots) {
73
80
  const summary = [];
74
- if (snapshots.added)
81
+ if (snapshots.added) {
75
82
  summary.push(c.bold(c.green(`${snapshots.added} written`)));
76
- if (snapshots.unmatched)
83
+ }
84
+ if (snapshots.unmatched) {
77
85
  summary.push(c.bold(c.red(`${snapshots.unmatched} failed`)));
78
- if (snapshots.updated)
86
+ }
87
+ if (snapshots.updated) {
79
88
  summary.push(c.bold(c.green(`${snapshots.updated} updated `)));
89
+ }
80
90
  if (snapshots.filesRemoved) {
81
- if (snapshots.didUpdate)
91
+ if (snapshots.didUpdate) {
82
92
  summary.push(c.bold(c.green(`${snapshots.filesRemoved} files removed `)));
83
- else
84
- summary.push(c.bold(c.yellow(`${snapshots.filesRemoved} files obsolete `)));
93
+ } else {
94
+ summary.push(
95
+ c.bold(c.yellow(`${snapshots.filesRemoved} files obsolete `))
96
+ );
97
+ }
85
98
  }
86
99
  if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
87
100
  const [head, ...tail] = snapshots.filesRemovedList;
@@ -91,13 +104,21 @@ function renderSnapshotSummary(rootDir, snapshots) {
91
104
  });
92
105
  }
93
106
  if (snapshots.unchecked) {
94
- if (snapshots.didUpdate)
107
+ if (snapshots.didUpdate) {
95
108
  summary.push(c.bold(c.green(`${snapshots.unchecked} removed`)));
96
- else
109
+ } else {
97
110
  summary.push(c.bold(c.yellow(`${snapshots.unchecked} obsolete`)));
111
+ }
98
112
  snapshots.uncheckedKeysByFile.forEach((uncheckedFile) => {
99
- summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, uncheckedFile.filePath)}`);
100
- uncheckedFile.keys.forEach((key) => summary.push(` ${c.gray(F_DOT)} ${key}`));
113
+ summary.push(
114
+ `${c.gray(F_DOWN_RIGHT)} ${formatTestPath(
115
+ rootDir,
116
+ uncheckedFile.filePath
117
+ )}`
118
+ );
119
+ uncheckedFile.keys.forEach(
120
+ (key) => summary.push(` ${c.gray(F_DOT)} ${key}`)
121
+ );
101
122
  });
102
123
  }
103
124
  return summary;
@@ -109,8 +130,9 @@ function countTestErrors(tasks) {
109
130
  }, 0);
110
131
  }
111
132
  function getStateString(tasks, name = "tests", showTotal = true) {
112
- if (tasks.length === 0)
133
+ if (tasks.length === 0) {
113
134
  return c.dim(`no ${name}`);
135
+ }
114
136
  const passed = tasks.filter((i) => {
115
137
  var _a;
116
138
  return ((_a = i.result) == null ? void 0 : _a.state) === "pass";
@@ -130,13 +152,16 @@ function getStateString(tasks, name = "tests", showTotal = true) {
130
152
  }
131
153
  function getStateSymbol(task) {
132
154
  var _a;
133
- if (task.mode === "skip" || task.mode === "todo")
155
+ if (task.mode === "skip" || task.mode === "todo") {
134
156
  return skipped;
135
- if (!task.result)
136
- return c.gray("\xB7");
157
+ }
158
+ if (!task.result) {
159
+ return pending;
160
+ }
137
161
  if (task.result.state === "run") {
138
- if (task.type === "suite")
162
+ if (task.type === "suite") {
139
163
  return pointer;
164
+ }
140
165
  let spinner = spinnerMap.get(task);
141
166
  if (!spinner) {
142
167
  spinner = elegantSpinner();
@@ -145,10 +170,10 @@ function getStateSymbol(task) {
145
170
  return c.yellow(spinner());
146
171
  }
147
172
  if (task.result.state === "pass") {
148
- return ((_a = task.meta) == null ? void 0 : _a.benchmark) ? c.green(F_DOT) : c.green(F_CHECK);
173
+ return ((_a = task.meta) == null ? void 0 : _a.benchmark) ? benchmarkPass : testPass;
149
174
  }
150
175
  if (task.result.state === "fail") {
151
- return task.type === "suite" ? pointer : c.red(F_CROSS);
176
+ return task.type === "suite" ? suiteFail : taskFail;
152
177
  }
153
178
  return " ";
154
179
  }
@@ -181,21 +206,17 @@ function formatTimeString(date) {
181
206
  return date.toTimeString().split(" ")[0];
182
207
  }
183
208
  function formatProjectName(name, suffix = " ") {
184
- if (!name)
209
+ if (!name) {
185
210
  return "";
211
+ }
186
212
  const index = name.split("").reduce((acc, v, idx) => acc + v.charCodeAt(0) + idx, 0);
187
- const colors = [
188
- c.blue,
189
- c.yellow,
190
- c.cyan,
191
- c.green,
192
- c.magenta
193
- ];
213
+ const colors = [c.blue, c.yellow, c.cyan, c.green, c.magenta];
194
214
  return colors[index % colors.length](`|${name}|`) + suffix;
195
215
  }
196
216
 
197
217
  var utils = /*#__PURE__*/Object.freeze({
198
218
  __proto__: null,
219
+ benchmarkPass: benchmarkPass,
199
220
  countTestErrors: countTestErrors,
200
221
  divider: divider,
201
222
  elegantSpinner: elegantSpinner,
@@ -207,11 +228,15 @@ var utils = /*#__PURE__*/Object.freeze({
207
228
  getStateString: getStateString,
208
229
  getStateSymbol: getStateSymbol,
209
230
  hookSpinnerMap: hookSpinnerMap,
231
+ pending: pending,
210
232
  pointer: pointer,
211
233
  renderSnapshotSummary: renderSnapshotSummary,
212
234
  skipped: skipped,
213
235
  spinnerFrames: spinnerFrames,
214
- spinnerMap: spinnerMap
236
+ spinnerMap: spinnerMap,
237
+ suiteFail: suiteFail,
238
+ taskFail: taskFail,
239
+ testPass: testPass
215
240
  });
216
241
 
217
- export { F_RIGHT as F, F_POINTER as a, getStateString as b, formatTimeString as c, countTestErrors as d, divider as e, formatProjectName as f, getStateSymbol as g, getCols as h, getHookStateSymbol as i, pointer as p, renderSnapshotSummary as r, stripAnsi as s, utils as u };
242
+ export { F_RIGHT as F, F_POINTER as a, getStateString as b, formatTimeString as c, countTestErrors as d, divider as e, formatProjectName as f, getStateSymbol as g, getCols as h, getHookStateSymbol as i, renderSnapshotSummary as r, stripAnsi as s, taskFail as t, utils as u };
@@ -4,7 +4,9 @@ var _a, _b;
4
4
  const REGEXP_WRAP_PREFIX = "$$vitest:";
5
5
  const processSend = (_a = process.send) == null ? void 0 : _a.bind(process);
6
6
  const processOn = (_b = process.on) == null ? void 0 : _b.bind(process);
7
- function createThreadsRpcOptions({ port }) {
7
+ function createThreadsRpcOptions({
8
+ port
9
+ }) {
8
10
  return {
9
11
  post: (v) => {
10
12
  port.postMessage(v);
@@ -23,8 +25,9 @@ function createForksRpcOptions(nodeV8) {
23
25
  },
24
26
  on(fn) {
25
27
  processOn("message", (message, ...extras) => {
26
- if (message == null ? void 0 : message.__tinypool_worker_message__)
28
+ if (message == null ? void 0 : message.__tinypool_worker_message__) {
27
29
  return;
30
+ }
28
31
  return fn(message, ...extras);
29
32
  });
30
33
  }
@@ -33,14 +36,18 @@ function createForksRpcOptions(nodeV8) {
33
36
  function unwrapSerializableConfig(config) {
34
37
  if (config.testNamePattern && typeof config.testNamePattern === "string") {
35
38
  const testNamePattern = config.testNamePattern;
36
- if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX))
37
- config.testNamePattern = parseRegexp(testNamePattern.slice(REGEXP_WRAP_PREFIX.length));
39
+ if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX)) {
40
+ config.testNamePattern = parseRegexp(
41
+ testNamePattern.slice(REGEXP_WRAP_PREFIX.length)
42
+ );
43
+ }
38
44
  }
39
45
  if (config.defines && Array.isArray(config.defines.keys) && config.defines.original) {
40
46
  const { keys, original } = config.defines;
41
47
  const defines = {};
42
- for (const key of keys)
48
+ for (const key of keys) {
43
49
  defines[key] = original[key];
50
+ }
44
51
  config.defines = defines;
45
52
  }
46
53
  return config;