vitest 1.2.2 → 1.3.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 (57) hide show
  1. package/LICENSE.md +30 -2
  2. package/dist/browser.d.ts +3 -2
  3. package/dist/browser.js +2 -1
  4. package/dist/chunks/{integrations-globals.J_6tnlri.js → integrations-globals.THajbSRg.js} +6 -6
  5. package/dist/chunks/{runtime-runBaseTests.QReNMrJA.js → runtime-runBaseTests.9RbsHRbU.js} +9 -9
  6. package/dist/cli-wrapper.js +1 -1
  7. package/dist/cli.js +44 -131
  8. package/dist/config.cjs +1 -1
  9. package/dist/config.d.ts +1 -1
  10. package/dist/coverage.d.ts +6 -6
  11. package/dist/coverage.js +34 -3
  12. package/dist/environments.d.ts +1 -1
  13. package/dist/environments.js +1 -1
  14. package/dist/execute.d.ts +1 -1
  15. package/dist/execute.js +2 -2
  16. package/dist/index.d.ts +75 -78
  17. package/dist/index.js +7 -7
  18. package/dist/node.d.ts +12 -4
  19. package/dist/node.js +35 -27
  20. package/dist/{reporters-1evA5lom.d.ts → reporters-MmQN-57K.d.ts} +177 -61
  21. package/dist/reporters.d.ts +1 -1
  22. package/dist/reporters.js +20 -6
  23. package/dist/runners.d.ts +6 -6
  24. package/dist/runners.js +10 -10
  25. package/dist/{suite-ghspeorC.d.ts → suite-UrZdHRff.d.ts} +1 -1
  26. package/dist/suite.d.ts +2 -2
  27. package/dist/suite.js +2 -2
  28. package/dist/vendor/{base.QYERqzkH.js → base.N3JkKp7j.js} +1 -1
  29. package/dist/vendor/{base.Rmxiv35Y.js → base.Z38YsPLm.js} +2 -2
  30. package/dist/vendor/{benchmark.IlKmJkUU.js → benchmark.eeqk2rd8.js} +1 -1
  31. package/dist/vendor/{node.Zme77R4t.js → cac.wWT9ELdg.js} +9225 -5219
  32. package/dist/vendor/{constants.i1PoEnhr.js → constants.K-Wf1PUy.js} +3 -1
  33. package/dist/vendor/{execute.TxmaEFIQ.js → execute.27Kk4lQF.js} +23 -12
  34. package/dist/vendor/{index.cAUulNDf.js → index.8bPxjt7g.js} +6 -1
  35. package/dist/vendor/{index.RDKo8czB.js → index.9hqYxJUw.js} +7 -3
  36. package/dist/vendor/{environments.sU0TD7wX.js → index.GVFv9dZ0.js} +3 -0
  37. package/dist/vendor/{index.LgG0iblq.js → index.JZMafwT-.js} +4 -3
  38. package/dist/vendor/index.c1V_jzyZ.js +4927 -0
  39. package/dist/vendor/{index.rJjbcrrp.js → index.ir9i0ywP.js} +1 -1
  40. package/dist/vendor/{rpc.w4v8oCkK.js → rpc.joBhAkyK.js} +10 -1
  41. package/dist/vendor/setup-common.snyQUvE3.js +45 -0
  42. package/dist/vendor/{vi.PPwhENHF.js → vi.C5mroSoP.js} +2 -1
  43. package/dist/vendor/{vm.jVxKtN5R.js → vm.o1IruPAo.js} +25 -8
  44. package/dist/worker.js +5 -10
  45. package/dist/workers/forks.js +3 -3
  46. package/dist/workers/runVmTests.js +13 -9
  47. package/dist/workers/threads.js +3 -3
  48. package/dist/workers/vmForks.js +4 -4
  49. package/dist/workers/vmThreads.js +4 -4
  50. package/dist/workers.d.ts +3 -3
  51. package/dist/workers.js +8 -8
  52. package/globals.d.ts +2 -0
  53. package/jsdom.d.ts +6 -0
  54. package/package.json +24 -21
  55. package/dist/chunks/api-setup.srzH0bDf.js +0 -4808
  56. package/dist/vendor/reporters.cA9x-5v-.js +0 -2664
  57. package/dist/vendor/setup-common.C2iBd0K0.js +0 -29
package/dist/runners.js CHANGED
@@ -1,24 +1,24 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.PPwhENHF.js';
3
- import './vendor/index.rJjbcrrp.js';
4
- import { r as rpc } from './vendor/rpc.w4v8oCkK.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.C5mroSoP.js';
3
+ import './vendor/index.ir9i0ywP.js';
4
+ import { r as rpc } from './vendor/rpc.joBhAkyK.js';
5
5
  import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
6
6
  import { g as getWorkerState } from './vendor/global.CkGT_TMy.js';
7
7
  import { getTests, getNames } from '@vitest/runner/utils';
8
8
  import { updateTask } from '@vitest/runner';
9
9
  import { createDefer, getSafeTimers } from '@vitest/utils';
10
- import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.IlKmJkUU.js';
10
+ import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.eeqk2rd8.js';
11
11
  import 'chai';
12
12
  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.QYERqzkH.js';
16
+ import './vendor/base.N3JkKp7j.js';
17
17
  import './vendor/date.Ns1pGd_X.js';
18
18
  import '@vitest/spy';
19
19
  import 'pathe';
20
20
  import 'std-env';
21
- import './vendor/index.cAUulNDf.js';
21
+ import './vendor/index.8bPxjt7g.js';
22
22
 
23
23
  class VitestTestRunner {
24
24
  constructor(config) {
@@ -76,14 +76,14 @@ class VitestTestRunner {
76
76
  }
77
77
  }
78
78
  onBeforeTryTask(test) {
79
- var _a;
79
+ var _a, _b;
80
80
  setState({
81
81
  assertionCalls: 0,
82
82
  isExpectingAssertions: false,
83
83
  isExpectingAssertionsError: null,
84
84
  expectedAssertionsNumber: null,
85
85
  expectedAssertionsNumberErrorGen: null,
86
- testPath: (_a = test.suite.file) == null ? void 0 : _a.filepath,
86
+ testPath: (_b = (_a = test.suite) == null ? void 0 : _a.file) == null ? void 0 : _b.filepath,
87
87
  currentTestName: getFullName(test),
88
88
  snapshotState: this.snapshotClient.snapshotState
89
89
  }, globalThis[GLOBAL_EXPECT]);
@@ -95,8 +95,8 @@ class VitestTestRunner {
95
95
  expectedAssertionsNumberErrorGen,
96
96
  isExpectingAssertions,
97
97
  isExpectingAssertionsError
98
- // @ts-expect-error local is untyped
99
- } = test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
98
+ // @ts-expect-error _local is untyped
99
+ } = "context" in test && test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
100
100
  if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber)
101
101
  throw expectedAssertionsNumberErrorGen();
102
102
  if (isExpectingAssertions === true && assertionCalls === 0)
@@ -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-1evA5lom.js';
3
+ import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-MmQN-57K.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-ghspeorC.js';
4
- import './reporters-1evA5lom.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './suite-UrZdHRff.js';
4
+ import './reporters-MmQN-57K.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, 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.IlKmJkUU.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './vendor/benchmark.eeqk2rd8.js';
4
4
  import '@vitest/utils';
5
- import './vendor/index.rJjbcrrp.js';
5
+ import './vendor/index.ir9i0ywP.js';
6
6
  import 'pathe';
7
7
  import 'std-env';
8
8
  import './vendor/global.CkGT_TMy.js';
@@ -102,4 +102,4 @@ function setProcessTitle(title) {
102
102
  }
103
103
  }
104
104
 
105
- export { AggregateErrorPonyfill as A, isPrimitive as a, slash as b, stdout as c, deepMerge as d, getAllMockableProperties as e, groupBy as g, isChildProcess as i, noop as n, setProcessTitle as s, toArray as t };
105
+ 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 };
@@ -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.TxmaEFIQ.js';
3
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.27Kk4lQF.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.QReNMrJA.js')
28
+ import('../chunks/runtime-runBaseTests.9RbsHRbU.js')
29
29
  ]);
30
30
  await run(
31
31
  ctx.files,
@@ -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.rJjbcrrp.js';
4
+ import { i as isRunningInBenchmark } from './index.ir9i0ywP.js';
5
5
 
6
6
  const benchFns = /* @__PURE__ */ new WeakMap();
7
7
  const benchOptsMap = /* @__PURE__ */ new WeakMap();