vitest 2.0.0-beta.10 → 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 (64) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +3 -3
  3. package/dist/chunks/{integrations-globals.C6Ah-pUW.js → integrations-globals.CC2ed6Py.js} +9 -9
  4. package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
  5. package/dist/chunks/{runtime-console.DiVMr5d4.js → runtime-console.Ckl0vEQr.js} +25 -10
  6. package/dist/chunks/{runtime-runBaseTests.Cukyr5-I.js → runtime-runBaseTests.BXW_BJeO.js} +40 -32
  7. package/dist/cli.js +3 -3
  8. package/dist/config.cjs +42 -19
  9. package/dist/config.d.ts +1 -1
  10. package/dist/config.js +42 -20
  11. package/dist/coverage.d.ts +4 -4
  12. package/dist/coverage.js +98 -36
  13. package/dist/environments.d.ts +1 -1
  14. package/dist/environments.js +1 -1
  15. package/dist/execute.d.ts +1 -1
  16. package/dist/execute.js +2 -2
  17. package/dist/index.d.ts +34 -8
  18. package/dist/index.js +9 -9
  19. package/dist/node.d.ts +19 -6
  20. package/dist/node.js +24 -16
  21. package/dist/path.js +4 -1
  22. package/dist/{reporters-CYVC6LOl.d.ts → reporters-fiIq_dT9.d.ts} +118 -179
  23. package/dist/reporters.d.ts +1 -1
  24. package/dist/reporters.js +7 -7
  25. package/dist/runners.d.ts +1 -1
  26. package/dist/runners.js +98 -60
  27. package/dist/{suite-Dpu9EC_k.d.ts → suite-D4aoU9rI.d.ts} +1 -1
  28. package/dist/suite.d.ts +2 -2
  29. package/dist/suite.js +2 -2
  30. package/dist/utils.d.ts +1 -5
  31. package/dist/utils.js +1 -6
  32. package/dist/vendor/{base.Dln9yllP.js → base.C2DbLEfT.js} +4 -3
  33. package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
  34. package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.CMp8QfyL.js} +13 -14
  35. package/dist/vendor/{cac.CtYFkoSJ.js → cac.BcJW7n2j.js} +71 -37
  36. package/dist/vendor/{cli-api.CUtJc4r3.js → cli-api.C8t8m4__.js} +4012 -4828
  37. package/dist/vendor/{constants.TCjCaw2D.js → constants.BWsVtsAj.js} +5 -22
  38. package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
  39. package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
  40. package/dist/vendor/{execute.BHj6OMh4.js → execute.T3gg2ZK6.js} +174 -60
  41. package/dist/vendor/{index.B5SKBLvV.js → index.-dbR4KUi.js} +17 -9
  42. package/dist/vendor/{index.BOMEjpjj.js → index.BC5zhX9y.js} +960 -469
  43. package/dist/vendor/{index.CThipSqB.js → index.BMmMjLIQ.js} +2540 -2540
  44. package/dist/vendor/{index._7XLd8Kd.js → index.C9Thslzw.js} +2 -1
  45. package/dist/vendor/{index.D3hs2WiI.js → index.CQJ2m700.js} +3 -3
  46. package/dist/vendor/{index.kpsSqFiz.js → index.D4nqnQWz.js} +69 -73
  47. package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
  48. package/dist/vendor/{run-once.DLomgGUH.js → run-once.Db8Hgq9X.js} +2 -1
  49. package/dist/vendor/{setup-common.DAu7t7mY.js → setup-common.uqZOEWuR.js} +30 -15
  50. package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
  51. package/dist/vendor/{utils.YuQ3LT2a.js → utils.DSO2UK15.js} +40 -25
  52. package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
  53. package/dist/vendor/{vi.hATFzZbX.js → vi.BPjl8cAZ.js} +266 -137
  54. package/dist/vendor/{vm.Ow-X2mkS.js → vm.CycSoHnJ.js} +151 -86
  55. package/dist/worker.js +31 -15
  56. package/dist/workers/forks.js +4 -4
  57. package/dist/workers/runVmTests.js +14 -13
  58. package/dist/workers/threads.js +4 -4
  59. package/dist/workers/vmForks.js +6 -6
  60. package/dist/workers/vmThreads.js +6 -6
  61. package/dist/workers.d.ts +2 -2
  62. package/dist/workers.js +9 -9
  63. package/package.json +11 -11
  64. package/suppress-warnings.cjs +1 -4
package/dist/runners.js CHANGED
@@ -1,25 +1,25 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.hATFzZbX.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.BPjl8cAZ.js';
3
3
  import 'pathe';
4
- import { g as getTestName } from './vendor/tasks.WC7M-K-v.js';
4
+ import { g as getTestName } from './vendor/tasks.DhVtQBtW.js';
5
5
  import { createDefer, getSafeTimers } from '@vitest/utils';
6
6
  import { g as getWorkerState } from './vendor/global.7bFbnyXl.js';
7
7
  import './vendor/env.bmJgw1qP.js';
8
- import { r as rpc } from './vendor/rpc.DRDE9Pu1.js';
8
+ import { r as rpc } from './vendor/rpc.BGx7q_k2.js';
9
9
  import { getTests, getNames } from '@vitest/runner/utils';
10
10
  import { updateTask } from '@vitest/runner';
11
- import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.BNLebNi5.js';
11
+ import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.CMp8QfyL.js';
12
12
  import 'chai';
13
13
  import './vendor/_commonjsHelpers.BFTU3MAI.js';
14
14
  import '@vitest/snapshot';
15
15
  import '@vitest/utils/error';
16
16
  import '@vitest/utils/source-map';
17
- import './vendor/base._gnK9Slw.js';
18
- import './vendor/date.BKM1wewY.js';
17
+ import './vendor/base.CTYV4Gnz.js';
18
+ import './vendor/date.W2xKR2qe.js';
19
19
  import '@vitest/spy';
20
20
  import 'std-env';
21
21
  import './vendor/index.BpSiYbpB.js';
22
- import './vendor/index._7XLd8Kd.js';
22
+ import './vendor/index.C9Thslzw.js';
23
23
 
24
24
  class VitestTestRunner {
25
25
  constructor(config) {
@@ -31,8 +31,9 @@ class VitestTestRunner {
31
31
  cancelRun = false;
32
32
  assertionsErrors = /* @__PURE__ */ new WeakMap();
33
33
  importFile(filepath, source) {
34
- if (source === "setup")
34
+ if (source === "setup") {
35
35
  this.workerState.moduleCache.delete(filepath);
36
+ }
36
37
  return this.__vitest_executor.executeId(filepath);
37
38
  }
38
39
  onCollectStart(file) {
@@ -45,8 +46,9 @@ class VitestTestRunner {
45
46
  this.workerState.current = void 0;
46
47
  }
47
48
  async onAfterRunSuite(suite) {
48
- if (this.config.logHeapUsage && typeof process !== "undefined")
49
+ if (this.config.logHeapUsage && typeof process !== "undefined") {
49
50
  suite.result.heap = process.memoryUsage().heapUsed;
51
+ }
50
52
  if (suite.mode !== "skip" && "filepath" in suite) {
51
53
  for (const test of getTests(suite)) {
52
54
  if (test.mode === "skip") {
@@ -55,47 +57,59 @@ class VitestTestRunner {
55
57
  }
56
58
  }
57
59
  const result = await this.snapshotClient.finishCurrentRun();
58
- if (result)
60
+ if (result) {
59
61
  await rpc().snapshotSaved(result);
62
+ }
60
63
  }
61
64
  this.workerState.current = suite.suite || suite.file;
62
65
  }
63
66
  onAfterRunTask(test) {
64
67
  this.snapshotClient.clearTest();
65
- if (this.config.logHeapUsage && typeof process !== "undefined")
68
+ if (this.config.logHeapUsage && typeof process !== "undefined") {
66
69
  test.result.heap = process.memoryUsage().heapUsed;
70
+ }
67
71
  this.workerState.current = test.suite || test.file;
68
72
  }
69
73
  onCancel(_reason) {
70
74
  this.cancelRun = true;
71
75
  }
72
76
  async onBeforeRunTask(test) {
73
- if (this.cancelRun)
77
+ if (this.cancelRun) {
74
78
  test.mode = "skip";
75
- if (test.mode !== "run")
79
+ }
80
+ if (test.mode !== "run") {
76
81
  return;
82
+ }
77
83
  clearModuleMocks(this.config);
78
84
  this.workerState.current = test;
79
85
  }
80
86
  async onBeforeRunSuite(suite) {
81
- if (this.cancelRun)
87
+ if (this.cancelRun) {
82
88
  suite.mode = "skip";
89
+ }
83
90
  if (suite.mode !== "skip" && "filepath" in suite) {
84
- await this.snapshotClient.startCurrentRun(suite.filepath, "__default_name_", this.workerState.config.snapshotOptions);
91
+ await this.snapshotClient.startCurrentRun(
92
+ suite.filepath,
93
+ "__default_name_",
94
+ this.workerState.config.snapshotOptions
95
+ );
85
96
  }
86
97
  this.workerState.current = suite;
87
98
  }
88
99
  onBeforeTryTask(test) {
89
- setState({
90
- assertionCalls: 0,
91
- isExpectingAssertions: false,
92
- isExpectingAssertionsError: null,
93
- expectedAssertionsNumber: null,
94
- expectedAssertionsNumberErrorGen: null,
95
- testPath: test.file.filepath,
96
- currentTestName: getTestName(test),
97
- snapshotState: this.snapshotClient.snapshotState
98
- }, globalThis[GLOBAL_EXPECT]);
100
+ setState(
101
+ {
102
+ assertionCalls: 0,
103
+ isExpectingAssertions: false,
104
+ isExpectingAssertionsError: null,
105
+ expectedAssertionsNumber: null,
106
+ expectedAssertionsNumberErrorGen: null,
107
+ testPath: test.file.filepath,
108
+ currentTestName: getTestName(test),
109
+ snapshotState: this.snapshotClient.snapshotState
110
+ },
111
+ globalThis[GLOBAL_EXPECT]
112
+ );
99
113
  }
100
114
  onAfterTryTask(test) {
101
115
  const {
@@ -104,23 +118,30 @@ class VitestTestRunner {
104
118
  expectedAssertionsNumberErrorGen,
105
119
  isExpectingAssertions,
106
120
  isExpectingAssertionsError
107
- // @ts-expect-error _local is untyped
108
121
  } = "context" in test && test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
109
- if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber)
122
+ if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber) {
110
123
  throw expectedAssertionsNumberErrorGen();
111
- if (isExpectingAssertions === true && assertionCalls === 0)
124
+ }
125
+ if (isExpectingAssertions === true && assertionCalls === 0) {
112
126
  throw isExpectingAssertionsError;
113
- if (this.config.expect.requireAssertions && assertionCalls === 0)
127
+ }
128
+ if (this.config.expect.requireAssertions && assertionCalls === 0) {
114
129
  throw this.assertionsErrors.get(test);
130
+ }
115
131
  }
116
132
  extendTaskContext(context) {
117
- if (this.config.expect.requireAssertions)
118
- this.assertionsErrors.set(context.task, new Error("expected any number of assertion, but got none"));
133
+ if (this.config.expect.requireAssertions) {
134
+ this.assertionsErrors.set(
135
+ context.task,
136
+ new Error("expected any number of assertion, but got none")
137
+ );
138
+ }
119
139
  let _expect;
120
140
  Object.defineProperty(context, "expect", {
121
141
  get() {
122
- if (!_expect)
142
+ if (!_expect) {
123
143
  _expect = createExpect(context.task);
144
+ }
124
145
  return _expect;
125
146
  }
126
147
  });
@@ -134,16 +155,19 @@ class VitestTestRunner {
134
155
  }
135
156
  function clearModuleMocks(config) {
136
157
  const { clearMocks, mockReset, restoreMocks, unstubEnvs, unstubGlobals } = config;
137
- if (restoreMocks)
158
+ if (restoreMocks) {
138
159
  vi.restoreAllMocks();
139
- else if (mockReset)
160
+ } else if (mockReset) {
140
161
  vi.resetAllMocks();
141
- else if (clearMocks)
162
+ } else if (clearMocks) {
142
163
  vi.clearAllMocks();
143
- if (unstubEnvs)
164
+ }
165
+ if (unstubEnvs) {
144
166
  vi.unstubAllEnvs();
145
- if (unstubGlobals)
167
+ }
168
+ if (unstubGlobals) {
146
169
  vi.unstubAllGlobals();
170
+ }
147
171
  }
148
172
 
149
173
  function createBenchmarkResult(name) {
@@ -162,15 +186,18 @@ async function runBenchmarkSuite(suite, runner) {
162
186
  const benchmarkGroup = [];
163
187
  const benchmarkSuiteGroup = [];
164
188
  for (const task of suite.tasks) {
165
- if (task.mode !== "run")
189
+ if (task.mode !== "run") {
166
190
  continue;
167
- if ((_a = task.meta) == null ? void 0 : _a.benchmark)
191
+ }
192
+ if ((_a = task.meta) == null ? void 0 : _a.benchmark) {
168
193
  benchmarkGroup.push(task);
169
- else if (task.type === "suite")
194
+ } else if (task.type === "suite") {
170
195
  benchmarkSuiteGroup.push(task);
196
+ }
171
197
  }
172
- for (const subSuite of benchmarkSuiteGroup)
198
+ for (const subSuite of benchmarkSuiteGroup) {
173
199
  await runBenchmarkSuite(subSuite, runner);
200
+ }
174
201
  if (benchmarkGroup.length) {
175
202
  const defer = createDefer();
176
203
  suite.result = {
@@ -180,21 +207,29 @@ async function runBenchmarkSuite(suite, runner) {
180
207
  };
181
208
  updateTask$1(suite);
182
209
  const addBenchTaskListener = (task, benchmark) => {
183
- task.addEventListener("complete", (e) => {
184
- const task2 = e.task;
185
- const taskRes = task2.result;
186
- const result = benchmark.result.benchmark;
187
- Object.assign(result, taskRes);
188
- updateTask$1(benchmark);
189
- }, {
190
- once: true
191
- });
192
- task.addEventListener("error", (e) => {
193
- const task2 = e.task;
194
- defer.reject(benchmark ? task2.result.error : e);
195
- }, {
196
- once: true
197
- });
210
+ task.addEventListener(
211
+ "complete",
212
+ (e) => {
213
+ const task2 = e.task;
214
+ const taskRes = task2.result;
215
+ const result = benchmark.result.benchmark;
216
+ Object.assign(result, taskRes);
217
+ updateTask$1(benchmark);
218
+ },
219
+ {
220
+ once: true
221
+ }
222
+ );
223
+ task.addEventListener(
224
+ "error",
225
+ (e) => {
226
+ const task2 = e.task;
227
+ defer.reject(benchmark ? task2.result.error : e);
228
+ },
229
+ {
230
+ once: true
231
+ }
232
+ );
198
233
  };
199
234
  benchmarkGroup.forEach((benchmark) => {
200
235
  const options = getBenchOptions(benchmark);
@@ -216,9 +251,11 @@ async function runBenchmarkSuite(suite, runner) {
216
251
  const task = benchmarkTasks.get(benchmark);
217
252
  await task.warmup();
218
253
  tasks.push([
219
- await new Promise((resolve) => setTimeout(async () => {
220
- resolve(await task.run());
221
- })),
254
+ await new Promise(
255
+ (resolve) => setTimeout(async () => {
256
+ resolve(await task.run());
257
+ })
258
+ ),
222
259
  benchmark
223
260
  ]);
224
261
  }
@@ -249,8 +286,9 @@ class NodeBenchmarkRunner {
249
286
  return await import('tinybench');
250
287
  }
251
288
  importFile(filepath, source) {
252
- if (source === "setup")
289
+ if (source === "setup") {
253
290
  getWorkerState().moduleCache.delete(filepath);
291
+ }
254
292
  return this.__vitest_executor.executeId(filepath);
255
293
  }
256
294
  async runSuite(suite) {
@@ -1,6 +1,6 @@
1
1
  import { Custom } from '@vitest/runner';
2
2
  import '@vitest/runner/utils';
3
- import { ag as BenchFunction, ah as BenchmarkAPI } from './reporters-CYVC6LOl.js';
3
+ import { ah as BenchFunction, ai as BenchmarkAPI } from './reporters-fiIq_dT9.js';
4
4
  import { Options } from 'tinybench';
5
5
 
6
6
  declare function getBenchOptions(key: Custom): Options;
package/dist/suite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createTaskCollector, getCurrentSuite, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
- export { g as getBenchFn, a as getBenchOptions } from './suite-Dpu9EC_k.js';
4
- import './reporters-CYVC6LOl.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './suite-D4aoU9rI.js';
4
+ import './reporters-fiIq_dT9.js';
5
5
  import 'vite';
6
6
  import 'vite-node';
7
7
  import '@vitest/snapshot';
package/dist/suite.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { createTaskCollector, getCurrentSuite, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
- export { g as getBenchFn, a as getBenchOptions } from './vendor/benchmark.BNLebNi5.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './vendor/benchmark.CMp8QfyL.js';
4
4
  import '@vitest/utils';
5
- import './vendor/index._7XLd8Kd.js';
5
+ import './vendor/index.C9Thslzw.js';
6
6
  import 'pathe';
7
7
  import './vendor/global.7bFbnyXl.js';
8
8
  import './vendor/env.bmJgw1qP.js';
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,2 @@
1
- import * as _vitest_utils_source_map from '@vitest/utils/source-map';
2
1
  export * from '@vitest/utils';
3
-
4
- declare function loadSourceMapUtils(): Promise<typeof _vitest_utils_source_map>;
5
-
6
- export { loadSourceMapUtils };
2
+ export * from '@vitest/utils/source-map';
package/dist/utils.js CHANGED
@@ -1,7 +1,2 @@
1
1
  export * from '@vitest/utils';
2
-
3
- function loadSourceMapUtils() {
4
- return import('@vitest/utils/source-map');
5
- }
6
-
7
- export { loadSourceMapUtils };
2
+ export * from '@vitest/utils/source-map';
@@ -1,13 +1,14 @@
1
1
  import { ModuleCacheMap } from 'vite-node/client';
2
2
  import { p as provideWorkerState } from './global.7bFbnyXl.js';
3
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.BHj6OMh4.js';
3
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.T3gg2ZK6.js';
4
4
 
5
5
  let _viteNode;
6
6
  const moduleCache = new ModuleCacheMap();
7
7
  const mockMap = /* @__PURE__ */ new Map();
8
8
  async function startViteNode(options) {
9
- if (_viteNode)
9
+ if (_viteNode) {
10
10
  return _viteNode;
11
+ }
11
12
  _viteNode = await startVitestExecutor(options);
12
13
  return _viteNode;
13
14
  }
@@ -25,7 +26,7 @@ async function runBaseTests(state) {
25
26
  ctx.files.forEach((i) => state.moduleCache.delete(i));
26
27
  const [executor, { run }] = await Promise.all([
27
28
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
28
- import('../chunks/runtime-runBaseTests.Cukyr5-I.js')
29
+ import('../chunks/runtime-runBaseTests.BXW_BJeO.js')
29
30
  ]);
30
31
  await run(
31
32
  ctx.files,
@@ -17,28 +17,25 @@ function isPrimitive(value) {
17
17
  return value === null || typeof value !== "function" && typeof value !== "object";
18
18
  }
19
19
  function getAllMockableProperties(obj, isModule, constructors) {
20
- const {
21
- Map,
22
- Object: Object2,
23
- Function,
24
- RegExp: RegExp2,
25
- Array: Array2
26
- } = constructors;
20
+ const { Map, Object: Object2, Function, RegExp: RegExp2, Array: Array2 } = constructors;
27
21
  const allProps = new Map();
28
22
  let curr = obj;
29
23
  do {
30
- if (curr === Object2.prototype || curr === Function.prototype || curr === RegExp2.prototype)
24
+ if (curr === Object2.prototype || curr === Function.prototype || curr === RegExp2.prototype) {
31
25
  break;
26
+ }
32
27
  collectOwnProperties(curr, (key) => {
33
28
  const descriptor = Object2.getOwnPropertyDescriptor(curr, key);
34
- if (descriptor)
29
+ if (descriptor) {
35
30
  allProps.set(key, { key, descriptor });
31
+ }
36
32
  });
37
33
  } while (curr = Object2.getPrototypeOf(curr));
38
34
  if (isModule && !allProps.has("default") && "default" in obj) {
39
35
  const descriptor = Object2.getOwnPropertyDescriptor(obj, "default");
40
- if (descriptor)
36
+ if (descriptor) {
41
37
  allProps.set("default", { key: "default", descriptor });
38
+ }
42
39
  }
43
40
  return Array2.from(allProps.values());
44
41
  }
@@ -48,10 +45,12 @@ function slash(str) {
48
45
  function noop() {
49
46
  }
50
47
  function toArray(array) {
51
- if (array === null || array === void 0)
48
+ if (array === null || array === void 0) {
52
49
  array = [];
53
- if (Array.isArray(array))
50
+ }
51
+ if (Array.isArray(array)) {
54
52
  return array;
53
+ }
55
54
  return [array];
56
55
  }
57
56
  function toString(v) {
@@ -61,16 +60,19 @@ function isPlainObject(val) {
61
60
  return toString(val) === "[object Object]" && (!val.constructor || val.constructor.name === "Object");
62
61
  }
63
62
  function deepMerge(target, ...sources) {
64
- if (!sources.length)
63
+ if (!sources.length) {
65
64
  return target;
65
+ }
66
66
  const source = sources.shift();
67
- if (source === void 0)
67
+ if (source === void 0) {
68
68
  return target;
69
+ }
69
70
  if (isMergeableObject(target) && isMergeableObject(source)) {
70
71
  Object.keys(source).forEach((key) => {
71
72
  if (isMergeableObject(source[key])) {
72
- if (!target[key])
73
+ if (!target[key]) {
73
74
  target[key] = {};
75
+ }
74
76
  deepMerge(target[key], source[key]);
75
77
  } else {
76
78
  target[key] = source[key];
@@ -105,13 +107,18 @@ function escapeRegExp(s) {
105
107
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
106
108
  }
107
109
  function wildcardPatternToRegExp(pattern) {
108
- return new RegExp(`^${pattern.split("*").map(escapeRegExp).join(".*")}$`, "i");
110
+ return new RegExp(
111
+ `^${pattern.split("*").map(escapeRegExp).join(".*")}$`,
112
+ "i"
113
+ );
109
114
  }
110
115
  const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
111
116
  function nanoid(size = 21) {
112
117
  let id = "";
113
118
  let i = size;
114
- while (i--) id += urlAlphabet[Math.random() * 64 | 0];
119
+ while (i--) {
120
+ id += urlAlphabet[Math.random() * 64 | 0];
121
+ }
115
122
  return id;
116
123
  }
117
124
 
@@ -1,7 +1,7 @@
1
1
  import { getCurrentSuite } from '@vitest/runner';
2
2
  import { createChainable } from '@vitest/runner/utils';
3
3
  import { noop } from '@vitest/utils';
4
- import { i as isRunningInBenchmark } from './index._7XLd8Kd.js';
4
+ import { i as isRunningInBenchmark } from './index.C9Thslzw.js';
5
5
 
6
6
  const benchFns = /* @__PURE__ */ new WeakMap();
7
7
  const benchOptsMap = /* @__PURE__ */ new WeakMap();
@@ -11,20 +11,19 @@ function getBenchOptions(key) {
11
11
  function getBenchFn(key) {
12
12
  return benchFns.get(key);
13
13
  }
14
- const bench = createBenchmark(
15
- function(name, fn = noop, options = {}) {
16
- if (!isRunningInBenchmark())
17
- throw new Error("`bench()` is only available in benchmark mode.");
18
- const task = getCurrentSuite().task(formatName(name), {
19
- ...this,
20
- meta: {
21
- benchmark: true
22
- }
23
- });
24
- benchFns.set(task, fn);
25
- benchOptsMap.set(task, options);
14
+ const bench = createBenchmark(function(name, fn = noop, options = {}) {
15
+ if (!isRunningInBenchmark()) {
16
+ throw new Error("`bench()` is only available in benchmark mode.");
26
17
  }
27
- );
18
+ const task = getCurrentSuite().task(formatName(name), {
19
+ ...this,
20
+ meta: {
21
+ benchmark: true
22
+ }
23
+ });
24
+ benchFns.set(task, fn);
25
+ benchOptsMap.set(task, options);
26
+ });
28
27
  function createBenchmark(fn) {
29
28
  const benchmark = createChainable(
30
29
  ["skip", "only", "todo"],