vitest 1.3.0 → 1.4.0

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 (47) hide show
  1. package/LICENSE.md +1 -2
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +1 -1
  4. package/dist/chunks/{integrations-globals.FlQVNhQx.js → integrations-globals.trMeEBob.js} +3 -3
  5. package/dist/chunks/{runtime-console.Iloo9fIt.js → runtime-console.tUKE_2UJ.js} +4 -4
  6. package/dist/chunks/{runtime-runBaseTests.0UwIvo_U.js → runtime-runBaseTests.SKlFOhuq.js} +6 -6
  7. package/dist/cli.js +41 -1373
  8. package/dist/config.d.ts +1 -1
  9. package/dist/coverage.d.ts +6 -6
  10. package/dist/coverage.js +34 -3
  11. package/dist/environments.d.ts +1 -1
  12. package/dist/execute.d.ts +1 -1
  13. package/dist/execute.js +2 -2
  14. package/dist/index.d.ts +5 -3
  15. package/dist/index.js +4 -4
  16. package/dist/node.d.ts +11 -3
  17. package/dist/node.js +21 -13
  18. package/dist/{reporters-QGe8gs4b.d.ts → reporters-P7C2ytIv.d.ts} +230 -173
  19. package/dist/reporters.d.ts +1 -1
  20. package/dist/reporters.js +3 -3
  21. package/dist/runners.d.ts +2 -1
  22. package/dist/runners.js +8 -3
  23. package/dist/{suite-xGC-mxBC.d.ts → suite-a18diDsI.d.ts} +1 -1
  24. package/dist/suite.d.ts +2 -2
  25. package/dist/utils.d.ts +5 -0
  26. package/dist/utils.js +6 -0
  27. package/dist/vendor/{base.knFzp7G3.js → base.Xt0Omgh7.js} +9 -3
  28. package/dist/vendor/{base.RpormaJz.js → base.nhvUBzQY.js} +2 -2
  29. package/dist/vendor/{cli-api.RIYLcWhB.js → cac.RvTIWZBK.js} +6288 -106
  30. package/dist/vendor/{execute.aFSzc0Da.js → execute.2_yoIC01.js} +1 -1
  31. package/dist/vendor/{index.n-Ib4UWN.js → index.BeX1oZht.js} +1 -1
  32. package/dist/vendor/{index.CKbXK54q.js → index.LNWuEnUT.js} +1 -1
  33. package/dist/vendor/{index.QcWmThJv.js → index.e9RDLAeW.js} +43 -25
  34. package/dist/vendor/{setup-common.NSpEdAQm.js → setup-common.vyF1kALR.js} +1 -1
  35. package/dist/vendor/{utils.GbToHGHI.js → utils.w0xgzP1h.js} +15 -10
  36. package/dist/vendor/{vi.-Nr_x6dl.js → vi.JYQecGiw.js} +16 -1
  37. package/dist/vendor/{vm.UmCkcXp-.js → vm.cAHVDF92.js} +2 -2
  38. package/dist/worker.js +20 -5
  39. package/dist/workers/forks.js +5 -5
  40. package/dist/workers/runVmTests.js +5 -5
  41. package/dist/workers/threads.js +4 -4
  42. package/dist/workers/vmForks.js +6 -6
  43. package/dist/workers/vmThreads.js +5 -5
  44. package/dist/workers.d.ts +6 -3
  45. package/dist/workers.js +6 -6
  46. package/package.json +10 -10
  47. package/dist/chunks/api-setup.Xh60JpeM.js +0 -4771
package/dist/runners.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.-Nr_x6dl.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.JYQecGiw.js';
3
3
  import './vendor/index.ir9i0ywP.js';
4
4
  import { r as rpc } from './vendor/rpc.joBhAkyK.js';
5
5
  import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
@@ -13,7 +13,7 @@ import './vendor/_commonjsHelpers.jjO7Zipk.js';
13
13
  import '@vitest/snapshot';
14
14
  import '@vitest/utils/error';
15
15
  import '@vitest/utils/source-map';
16
- import './vendor/base.knFzp7G3.js';
16
+ import './vendor/base.Xt0Omgh7.js';
17
17
  import './vendor/date.Ns1pGd_X.js';
18
18
  import '@vitest/spy';
19
19
  import 'pathe';
@@ -36,6 +36,9 @@ class VitestTestRunner {
36
36
  onBeforeRunFiles() {
37
37
  this.snapshotClient.clear();
38
38
  }
39
+ onAfterRunFiles() {
40
+ this.workerState.current = void 0;
41
+ }
39
42
  async onAfterRunSuite(suite) {
40
43
  if (this.config.logHeapUsage && typeof process !== "undefined")
41
44
  suite.result.heap = process.memoryUsage().heapUsed;
@@ -50,12 +53,13 @@ class VitestTestRunner {
50
53
  if (result)
51
54
  await rpc().snapshotSaved(result);
52
55
  }
56
+ this.workerState.current = suite.suite;
53
57
  }
54
58
  onAfterRunTask(test) {
55
59
  this.snapshotClient.clearTest();
56
60
  if (this.config.logHeapUsage && typeof process !== "undefined")
57
61
  test.result.heap = process.memoryUsage().heapUsed;
58
- this.workerState.current = void 0;
62
+ this.workerState.current = test.suite;
59
63
  }
60
64
  onCancel(_reason) {
61
65
  this.cancelRun = true;
@@ -74,6 +78,7 @@ class VitestTestRunner {
74
78
  if (suite.mode !== "skip" && typeof suite.filepath !== "undefined") {
75
79
  await this.snapshotClient.startCurrentRun(suite.filepath, "__default_name_", this.workerState.config.snapshotOptions);
76
80
  }
81
+ this.workerState.current = suite;
77
82
  }
78
83
  onBeforeTryTask(test) {
79
84
  var _a, _b;
@@ -1,6 +1,6 @@
1
1
  import { Custom } from '@vitest/runner';
2
2
  import '@vitest/runner/utils';
3
- import { ao as BenchFunction, ap as BenchmarkAPI } from './reporters-QGe8gs4b.js';
3
+ import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-P7C2ytIv.js';
4
4
  import { Options } from 'tinybench';
5
5
 
6
6
  declare function getBenchOptions(key: Custom): Options;
package/dist/suite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createTaskCollector, getCurrentSuite, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
- export { g as getBenchFn, a as getBenchOptions } from './suite-xGC-mxBC.js';
4
- import './reporters-QGe8gs4b.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './suite-a18diDsI.js';
4
+ import './reporters-P7C2ytIv.js';
5
5
  import 'vite';
6
6
  import 'vite-node';
7
7
  import '@vitest/snapshot';
package/dist/utils.d.ts CHANGED
@@ -1 +1,6 @@
1
+ import * as _vitest_utils_source_map from '@vitest/utils/source-map';
1
2
  export * from '@vitest/utils';
3
+
4
+ declare function loadSourceMapUtils(): Promise<typeof _vitest_utils_source_map>;
5
+
6
+ export { loadSourceMapUtils };
package/dist/utils.js CHANGED
@@ -1 +1,7 @@
1
1
  export * from '@vitest/utils';
2
+
3
+ function loadSourceMapUtils() {
4
+ return import('@vitest/utils/source-map');
5
+ }
6
+
7
+ export { loadSourceMapUtils };
@@ -21,13 +21,13 @@ function getAllMockableProperties(obj, isModule, constructors) {
21
21
  Map,
22
22
  Object: Object2,
23
23
  Function,
24
- RegExp,
24
+ RegExp: RegExp2,
25
25
  Array: Array2
26
26
  } = constructors;
27
27
  const allProps = new Map();
28
28
  let curr = obj;
29
29
  do {
30
- if (curr === Object2.prototype || curr === Function.prototype || curr === RegExp.prototype)
30
+ if (curr === Object2.prototype || curr === Function.prototype || curr === RegExp2.prototype)
31
31
  break;
32
32
  collectOwnProperties(curr, (key) => {
33
33
  const descriptor = Object2.getOwnPropertyDescriptor(curr, key);
@@ -101,5 +101,11 @@ function setProcessTitle(title) {
101
101
  } catch {
102
102
  }
103
103
  }
104
+ function escapeRegExp(s) {
105
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
106
+ }
107
+ function wildcardPatternToRegExp(pattern) {
108
+ return new RegExp(`^${pattern.split("*").map(escapeRegExp).join(".*")}$`, "i");
109
+ }
104
110
 
105
- export { AggregateErrorPonyfill as A, isPrimitive as a, slash as b, groupBy as c, deepMerge as d, stdout as e, getAllMockableProperties as g, isChildProcess as i, noop as n, setProcessTitle as s, toArray as t };
111
+ export { AggregateErrorPonyfill as A, slash as a, isPrimitive as b, groupBy as c, deepMerge as d, stdout as e, getAllMockableProperties as g, isChildProcess as i, noop as n, setProcessTitle as s, toArray as t, wildcardPatternToRegExp as w };
@@ -1,6 +1,6 @@
1
1
  import { ModuleCacheMap } from 'vite-node/client';
2
2
  import { p as provideWorkerState } from './global.CkGT_TMy.js';
3
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.aFSzc0Da.js';
3
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.2_yoIC01.js';
4
4
 
5
5
  let _viteNode;
6
6
  const moduleCache = new ModuleCacheMap();
@@ -25,7 +25,7 @@ async function runBaseTests(state) {
25
25
  ctx.files.forEach((i) => state.moduleCache.delete(i));
26
26
  const [executor, { run }] = await Promise.all([
27
27
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
28
- import('../chunks/runtime-runBaseTests.0UwIvo_U.js')
28
+ import('../chunks/runtime-runBaseTests.SKlFOhuq.js')
29
29
  ]);
30
30
  await run(
31
31
  ctx.files,