@voidzero-dev/vite-plus-test 0.0.0-0bfcc90f.20260209-0731

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 (318) hide show
  1. package/LICENSE.md +691 -0
  2. package/browser/context.d.ts +4 -0
  3. package/browser/context.js +20 -0
  4. package/config.d.ts +3 -0
  5. package/coverage.d.ts +1 -0
  6. package/dist/@vitest/browser/client/.vite/manifest.json +24 -0
  7. package/dist/@vitest/browser/client/__vitest__/assets/index-BUCFJtth.js +57 -0
  8. package/dist/@vitest/browser/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
  9. package/dist/@vitest/browser/client/__vitest__/bg.png +0 -0
  10. package/dist/@vitest/browser/client/__vitest__/favicon.ico +0 -0
  11. package/dist/@vitest/browser/client/__vitest__/favicon.svg +5 -0
  12. package/dist/@vitest/browser/client/__vitest__/index.html +32 -0
  13. package/dist/@vitest/browser/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
  14. package/dist/@vitest/browser/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
  15. package/dist/@vitest/browser/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
  16. package/dist/@vitest/browser/client/error-catcher.js +82 -0
  17. package/dist/@vitest/browser/client/esm-client-injector.js +67 -0
  18. package/dist/@vitest/browser/client/favicon.svg +5 -0
  19. package/dist/@vitest/browser/client/orchestrator.html +35 -0
  20. package/dist/@vitest/browser/client/tester/tester.html +13 -0
  21. package/dist/@vitest/browser/client.js +456 -0
  22. package/dist/@vitest/browser/context.d.ts +792 -0
  23. package/dist/@vitest/browser/context.js +541 -0
  24. package/dist/@vitest/browser/expect-element.js +32 -0
  25. package/dist/@vitest/browser/index-D6m36C6U.js +11 -0
  26. package/dist/@vitest/browser/index.d.ts +73 -0
  27. package/dist/@vitest/browser/index.js +3513 -0
  28. package/dist/@vitest/browser/jest-dom.d.ts +724 -0
  29. package/dist/@vitest/browser/locators.d.ts +354 -0
  30. package/dist/@vitest/browser/locators.js +1 -0
  31. package/dist/@vitest/browser/matchers.d.ts +29 -0
  32. package/dist/@vitest/browser/shared/screenshotMatcher/types.d.ts +22 -0
  33. package/dist/@vitest/browser/state.js +280 -0
  34. package/dist/@vitest/browser/types.d.ts +69 -0
  35. package/dist/@vitest/browser-playwright/context.d.ts +1 -0
  36. package/dist/@vitest/browser-playwright/index.d.ts +106 -0
  37. package/dist/@vitest/browser-playwright/index.js +1111 -0
  38. package/dist/@vitest/browser-playwright/locators.js +114 -0
  39. package/dist/@vitest/browser-preview/context.d.ts +1 -0
  40. package/dist/@vitest/browser-preview/index.d.ts +19 -0
  41. package/dist/@vitest/browser-preview/index.js +148 -0
  42. package/dist/@vitest/browser-preview/locators.js +79 -0
  43. package/dist/@vitest/browser-webdriverio/context.d.ts +1 -0
  44. package/dist/@vitest/browser-webdriverio/index.d.ts +63 -0
  45. package/dist/@vitest/browser-webdriverio/index.js +600 -0
  46. package/dist/@vitest/browser-webdriverio/locators.js +163 -0
  47. package/dist/@vitest/expect/index.d.ts +807 -0
  48. package/dist/@vitest/expect/index.js +1875 -0
  49. package/dist/@vitest/mocker/auto-register.d.ts +2 -0
  50. package/dist/@vitest/mocker/auto-register.js +9 -0
  51. package/dist/@vitest/mocker/automock.d.ts +12 -0
  52. package/dist/@vitest/mocker/automock.js +1 -0
  53. package/dist/@vitest/mocker/browser.d.ts +53 -0
  54. package/dist/@vitest/mocker/browser.js +91 -0
  55. package/dist/@vitest/mocker/chunk-automock.js +354 -0
  56. package/dist/@vitest/mocker/chunk-interceptor-native.js +15 -0
  57. package/dist/@vitest/mocker/chunk-mocker.js +521 -0
  58. package/dist/@vitest/mocker/chunk-pathe.M-eThtNZ.js +174 -0
  59. package/dist/@vitest/mocker/chunk-registry.js +185 -0
  60. package/dist/@vitest/mocker/chunk-utils.js +16 -0
  61. package/dist/@vitest/mocker/index.d-C-sLYZi-.d.ts +25 -0
  62. package/dist/@vitest/mocker/index.d.ts +2 -0
  63. package/dist/@vitest/mocker/index.js +185 -0
  64. package/dist/@vitest/mocker/mocker.d-TnKRhz7N.d.ts +81 -0
  65. package/dist/@vitest/mocker/node.d.ts +800 -0
  66. package/dist/@vitest/mocker/node.js +966 -0
  67. package/dist/@vitest/mocker/redirect.d.ts +3 -0
  68. package/dist/@vitest/mocker/redirect.js +79 -0
  69. package/dist/@vitest/mocker/register.d.ts +9 -0
  70. package/dist/@vitest/mocker/register.js +41 -0
  71. package/dist/@vitest/mocker/types.d-B8CCKmHt.d.ts +107 -0
  72. package/dist/@vitest/pretty-format/index.d.ts +124 -0
  73. package/dist/@vitest/pretty-format/index.js +1022 -0
  74. package/dist/@vitest/runner/chunk-tasks.js +340 -0
  75. package/dist/@vitest/runner/index.d.ts +180 -0
  76. package/dist/@vitest/runner/index.js +2114 -0
  77. package/dist/@vitest/runner/tasks.d-C7UxawJ9.d.ts +834 -0
  78. package/dist/@vitest/runner/types.d.ts +183 -0
  79. package/dist/@vitest/runner/types.js +1 -0
  80. package/dist/@vitest/runner/utils.d.ts +45 -0
  81. package/dist/@vitest/runner/utils.js +5 -0
  82. package/dist/@vitest/snapshot/environment.d-DHdQ1Csl.d.ts +22 -0
  83. package/dist/@vitest/snapshot/environment.d.ts +16 -0
  84. package/dist/@vitest/snapshot/environment.js +40 -0
  85. package/dist/@vitest/snapshot/index.d.ts +130 -0
  86. package/dist/@vitest/snapshot/index.js +1437 -0
  87. package/dist/@vitest/snapshot/manager.d.ts +18 -0
  88. package/dist/@vitest/snapshot/manager.js +73 -0
  89. package/dist/@vitest/snapshot/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
  90. package/dist/@vitest/spy/index.d.ts +384 -0
  91. package/dist/@vitest/spy/index.js +433 -0
  92. package/dist/@vitest/utils/chunk-_commonjsHelpers.js +5 -0
  93. package/dist/@vitest/utils/chunk-pathe.M-eThtNZ.js +156 -0
  94. package/dist/@vitest/utils/constants.d.ts +21 -0
  95. package/dist/@vitest/utils/constants.js +49 -0
  96. package/dist/@vitest/utils/diff.d.ts +93 -0
  97. package/dist/@vitest/utils/diff.js +2199 -0
  98. package/dist/@vitest/utils/display.d.ts +29 -0
  99. package/dist/@vitest/utils/display.js +742 -0
  100. package/dist/@vitest/utils/error.d.ts +7 -0
  101. package/dist/@vitest/utils/error.js +42 -0
  102. package/dist/@vitest/utils/helpers.d.ts +73 -0
  103. package/dist/@vitest/utils/helpers.js +295 -0
  104. package/dist/@vitest/utils/highlight.d.ts +9 -0
  105. package/dist/@vitest/utils/highlight.js +538 -0
  106. package/dist/@vitest/utils/index.d.ts +5 -0
  107. package/dist/@vitest/utils/index.js +1 -0
  108. package/dist/@vitest/utils/offset.d.ts +5 -0
  109. package/dist/@vitest/utils/offset.js +32 -0
  110. package/dist/@vitest/utils/resolver.d.ts +7 -0
  111. package/dist/@vitest/utils/resolver.js +71 -0
  112. package/dist/@vitest/utils/serialize.d.ts +3 -0
  113. package/dist/@vitest/utils/serialize.js +118 -0
  114. package/dist/@vitest/utils/source-map.d.ts +55 -0
  115. package/dist/@vitest/utils/source-map.js +478 -0
  116. package/dist/@vitest/utils/timers.d.ts +33 -0
  117. package/dist/@vitest/utils/timers.js +49 -0
  118. package/dist/@vitest/utils/types.d-BCElaP-c.d.ts +53 -0
  119. package/dist/@vitest/utils/types.d.ts +34 -0
  120. package/dist/@vitest/utils/types.js +1 -0
  121. package/dist/browser-compat.js +3 -0
  122. package/dist/browser.d.ts +46 -0
  123. package/dist/browser.js +20 -0
  124. package/dist/chunks/_commonjsHelpers.D26ty3Ew.js +6 -0
  125. package/dist/chunks/base.CJ0Y4ePK.js +165 -0
  126. package/dist/chunks/benchmark.B3N2zMcH.js +40 -0
  127. package/dist/chunks/benchmark.d.DAaHLpsq.d.ts +24 -0
  128. package/dist/chunks/browser.d.ChKACdzH.d.ts +59 -0
  129. package/dist/chunks/cac.DVeoLl0M.js +1409 -0
  130. package/dist/chunks/cli-api.B7PN_QUv.js +13672 -0
  131. package/dist/chunks/config.d.Cy95HiCx.d.ts +210 -0
  132. package/dist/chunks/console.Cf-YriPC.js +146 -0
  133. package/dist/chunks/constants.D_Q9UYh-.js +36 -0
  134. package/dist/chunks/coverage.AVPTjMgw.js +3292 -0
  135. package/dist/chunks/coverage.D_JHT54q.js +25 -0
  136. package/dist/chunks/coverage.d.BZtK59WP.d.ts +37 -0
  137. package/dist/chunks/creator.DAmOKTvJ.js +673 -0
  138. package/dist/chunks/date.Bq6ZW5rf.js +73 -0
  139. package/dist/chunks/defaults.BOqNVLsY.js +74 -0
  140. package/dist/chunks/env.D4Lgay0q.js +8 -0
  141. package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
  142. package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
  143. package/dist/chunks/evaluatedModules.d.BxJ5omdx.d.ts +7 -0
  144. package/dist/chunks/git.Bm2pzPAa.js +71 -0
  145. package/dist/chunks/global.d.B15mdLcR.d.ts +99 -0
  146. package/dist/chunks/globals.DOayXfHP.js +30 -0
  147. package/dist/chunks/index.6Qv1eEA6.js +109 -0
  148. package/dist/chunks/index.C5r1PdPD.js +231 -0
  149. package/dist/chunks/index.Chj8NDwU.js +206 -0
  150. package/dist/chunks/index.CyBMJtT7.js +727 -0
  151. package/dist/chunks/index.D3XRDfWc.js +213 -0
  152. package/dist/chunks/index.D4KonVSU.js +6343 -0
  153. package/dist/chunks/index.M8mOzt4Y.js +3839 -0
  154. package/dist/chunks/index.Z5E_ObnR.js +37 -0
  155. package/dist/chunks/init-forks._y3TW739.js +41 -0
  156. package/dist/chunks/init-threads.DBO2kn-p.js +18 -0
  157. package/dist/chunks/init.B6MLFIaN.js +334 -0
  158. package/dist/chunks/inspector.CvyFGlXm.js +53 -0
  159. package/dist/chunks/modules.BJuCwlRJ.js +36 -0
  160. package/dist/chunks/node.Ce0vMQM7.js +14 -0
  161. package/dist/chunks/plugin.d.CtqpEehP.d.ts +38 -0
  162. package/dist/chunks/reporters.d.CWXNI2jG.d.ts +3271 -0
  163. package/dist/chunks/rpc.BoxB0q7B.js +76 -0
  164. package/dist/chunks/rpc.d.RH3apGEf.d.ts +64 -0
  165. package/dist/chunks/setup-common.Cm-kSBVi.js +60 -0
  166. package/dist/chunks/startModuleRunner.DEj0jb3e.js +861 -0
  167. package/dist/chunks/suite.d.BJWk38HB.d.ts +10 -0
  168. package/dist/chunks/test.B8ej_ZHS.js +254 -0
  169. package/dist/chunks/traces.CCmnQaNT.js +217 -0
  170. package/dist/chunks/traces.d.402V_yFI.d.ts +18 -0
  171. package/dist/chunks/utils.DvEY5TfP.js +52 -0
  172. package/dist/chunks/vi.2VT5v0um.js +3919 -0
  173. package/dist/chunks/vm.D3epNOPZ.js +744 -0
  174. package/dist/chunks/worker.d.Dyxm8DEL.d.ts +255 -0
  175. package/dist/cli.js +28 -0
  176. package/dist/client/.vite/manifest.json +24 -0
  177. package/dist/client/__vitest__/assets/index-BUCFJtth.js +57 -0
  178. package/dist/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
  179. package/dist/client/__vitest__/bg.png +0 -0
  180. package/dist/client/__vitest__/favicon.ico +0 -0
  181. package/dist/client/__vitest__/favicon.svg +5 -0
  182. package/dist/client/__vitest__/index.html +32 -0
  183. package/dist/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
  184. package/dist/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
  185. package/dist/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
  186. package/dist/client/error-catcher.js +82 -0
  187. package/dist/client/esm-client-injector.js +67 -0
  188. package/dist/client/favicon.svg +5 -0
  189. package/dist/client/orchestrator.html +35 -0
  190. package/dist/client/tester/tester.html +13 -0
  191. package/dist/client.js +456 -0
  192. package/dist/config.cjs +94 -0
  193. package/dist/config.d.ts +104 -0
  194. package/dist/config.js +15 -0
  195. package/dist/context.js +541 -0
  196. package/dist/coverage.d.ts +118 -0
  197. package/dist/coverage.js +23 -0
  198. package/dist/dummy.js +2 -0
  199. package/dist/environments.d.ts +22 -0
  200. package/dist/environments.js +3 -0
  201. package/dist/expect-element.js +27 -0
  202. package/dist/index-D6m36C6U.js +6 -0
  203. package/dist/index-node.js +7 -0
  204. package/dist/index.d.ts +510 -0
  205. package/dist/index.js +19 -0
  206. package/dist/locators.d.ts +354 -0
  207. package/dist/locators.js +1 -0
  208. package/dist/mocker.d.ts +1 -0
  209. package/dist/mocker.js +1 -0
  210. package/dist/module-evaluator.d.ts +124 -0
  211. package/dist/module-evaluator.js +343 -0
  212. package/dist/module-runner-stub.js +44 -0
  213. package/dist/module-runner.js +17 -0
  214. package/dist/node.d.ts +251 -0
  215. package/dist/node.js +98 -0
  216. package/dist/path.js +7 -0
  217. package/dist/plugins/browser-client.mjs +2 -0
  218. package/dist/plugins/browser-context.mjs +2 -0
  219. package/dist/plugins/browser-locators.mjs +2 -0
  220. package/dist/plugins/browser-playwright.mjs +2 -0
  221. package/dist/plugins/browser-preview.mjs +2 -0
  222. package/dist/plugins/browser-webdriverio.mjs +2 -0
  223. package/dist/plugins/browser.mjs +2 -0
  224. package/dist/plugins/expect.mjs +2 -0
  225. package/dist/plugins/mocker-automock.mjs +2 -0
  226. package/dist/plugins/mocker-browser.mjs +2 -0
  227. package/dist/plugins/mocker-node.mjs +2 -0
  228. package/dist/plugins/mocker-redirect.mjs +2 -0
  229. package/dist/plugins/mocker-register.mjs +2 -0
  230. package/dist/plugins/mocker.mjs +2 -0
  231. package/dist/plugins/pretty-format.mjs +2 -0
  232. package/dist/plugins/runner-types.mjs +2 -0
  233. package/dist/plugins/runner-utils.mjs +2 -0
  234. package/dist/plugins/runner.mjs +2 -0
  235. package/dist/plugins/snapshot-environment.mjs +2 -0
  236. package/dist/plugins/snapshot-manager.mjs +2 -0
  237. package/dist/plugins/snapshot.mjs +2 -0
  238. package/dist/plugins/spy.mjs +2 -0
  239. package/dist/plugins/utils-constants.mjs +2 -0
  240. package/dist/plugins/utils-diff.mjs +2 -0
  241. package/dist/plugins/utils-display.mjs +2 -0
  242. package/dist/plugins/utils-error.mjs +2 -0
  243. package/dist/plugins/utils-helpers.mjs +2 -0
  244. package/dist/plugins/utils-highlight.mjs +2 -0
  245. package/dist/plugins/utils-offset.mjs +2 -0
  246. package/dist/plugins/utils-resolver.mjs +2 -0
  247. package/dist/plugins/utils-serialize.mjs +2 -0
  248. package/dist/plugins/utils-source-map.mjs +2 -0
  249. package/dist/plugins/utils-timers.mjs +2 -0
  250. package/dist/plugins/utils.mjs +2 -0
  251. package/dist/reporters.d.ts +27 -0
  252. package/dist/reporters.js +24 -0
  253. package/dist/runners.d.ts +50 -0
  254. package/dist/runners.js +19 -0
  255. package/dist/shared/screenshotMatcher/types.d.ts +22 -0
  256. package/dist/snapshot.d.ts +9 -0
  257. package/dist/snapshot.js +4 -0
  258. package/dist/spy.js +1 -0
  259. package/dist/state.js +280 -0
  260. package/dist/suite.d.ts +5 -0
  261. package/dist/suite.js +6 -0
  262. package/dist/types.d.ts +69 -0
  263. package/dist/vendor/chai.d.mts +1 -0
  264. package/dist/vendor/chai.mjs +3577 -0
  265. package/dist/vendor/es-module-lexer.d.mts +193 -0
  266. package/dist/vendor/es-module-lexer.mjs +79 -0
  267. package/dist/vendor/estree-walker.d.mts +583 -0
  268. package/dist/vendor/estree-walker.mjs +339 -0
  269. package/dist/vendor/expect-type.d.mts +1574 -0
  270. package/dist/vendor/expect-type.mjs +214 -0
  271. package/dist/vendor/magic-string.d.mts +261 -0
  272. package/dist/vendor/magic-string.mjs +1700 -0
  273. package/dist/vendor/obug.d.mts +56 -0
  274. package/dist/vendor/obug.mjs +276 -0
  275. package/dist/vendor/pathe.d.mts +46 -0
  276. package/dist/vendor/pathe.mjs +496 -0
  277. package/dist/vendor/picomatch.d.mts +1 -0
  278. package/dist/vendor/picomatch.mjs +1855 -0
  279. package/dist/vendor/shared-3g9mwCWP.mjs +31 -0
  280. package/dist/vendor/std-env.d.mts +88 -0
  281. package/dist/vendor/std-env.mjs +159 -0
  282. package/dist/vendor/tinybench.d.mts +317 -0
  283. package/dist/vendor/tinybench.mjs +504 -0
  284. package/dist/vendor/tinyexec.d.mts +72 -0
  285. package/dist/vendor/tinyexec.mjs +637 -0
  286. package/dist/vendor/tinyglobby.d.mts +157 -0
  287. package/dist/vendor/tinyglobby.mjs +832 -0
  288. package/dist/vendor/tinyrainbow.d.mts +60 -0
  289. package/dist/vendor/tinyrainbow.mjs +93 -0
  290. package/dist/vendor/vitest_browser.mjs +2 -0
  291. package/dist/vendor/vitest_internal_browser.mjs +2 -0
  292. package/dist/vendor/vitest_runner.mjs +2 -0
  293. package/dist/vendor/vitest_runners.mjs +2 -0
  294. package/dist/worker.d.ts +32 -0
  295. package/dist/worker.js +48 -0
  296. package/dist/workers/forks.js +54 -0
  297. package/dist/workers/runVmTests.js +95 -0
  298. package/dist/workers/threads.js +55 -0
  299. package/dist/workers/vmForks.js +36 -0
  300. package/dist/workers/vmThreads.js +37 -0
  301. package/environments.d.ts +1 -0
  302. package/globals.d.ts +20 -0
  303. package/import-meta.d.ts +5 -0
  304. package/importMeta.d.ts +4 -0
  305. package/index.cjs +5 -0
  306. package/index.d.cts +1 -0
  307. package/jsdom.d.ts +6 -0
  308. package/mocker.d.ts +1 -0
  309. package/node.d.ts +1 -0
  310. package/optional-types.d.ts +7 -0
  311. package/package.json +335 -0
  312. package/reporters.d.ts +1 -0
  313. package/runners.d.ts +1 -0
  314. package/snapshot.d.ts +1 -0
  315. package/suite.d.ts +1 -0
  316. package/suppress-warnings.cjs +21 -0
  317. package/vitest.mjs +2 -0
  318. package/worker.d.ts +1 -0
@@ -0,0 +1,807 @@
1
+ /// <reference types="chai" />
2
+ import { Test } from '../runner/index.js';
3
+ import { MockInstance } from '../spy/index.js';
4
+ import { Constructable } from '../utils/index.js';
5
+ import { Formatter } from '../../vendor/tinyrainbow.mjs';
6
+ import { StandardSchemaV1 } from '@standard-schema/spec';
7
+ import { diff, printDiffOrStringify } from '../utils/diff.js';
8
+ export { DiffOptions } from '../utils/diff.js';
9
+ import { stringify } from '../utils/display.js';
10
+ import * as chai from '../../vendor/chai.mjs';
11
+ export { chai };
12
+
13
+ declare const MATCHERS_OBJECT: unique symbol;
14
+ declare const JEST_MATCHERS_OBJECT: unique symbol;
15
+ declare const GLOBAL_EXPECT: unique symbol;
16
+ declare const ASYMMETRIC_MATCHERS_OBJECT: unique symbol;
17
+
18
+ interface AsymmetricMatcherInterface {
19
+ asymmetricMatch: (other: unknown, customTesters?: Array<Tester>) => boolean;
20
+ toString: () => string;
21
+ getExpectedType?: () => string;
22
+ toAsymmetricMatcher?: () => string;
23
+ }
24
+ declare abstract class AsymmetricMatcher<
25
+ T,
26
+ State extends MatcherState = MatcherState
27
+ > implements AsymmetricMatcherInterface {
28
+ protected sample: T;
29
+ protected inverse: boolean;
30
+ $$typeof: symbol;
31
+ constructor(sample: T, inverse?: boolean);
32
+ protected getMatcherContext(expect?: Chai.ExpectStatic): State;
33
+ abstract asymmetricMatch(other: unknown, customTesters?: Array<Tester>): boolean;
34
+ abstract toString(): string;
35
+ getExpectedType?(): string;
36
+ toAsymmetricMatcher?(): string;
37
+ }
38
+ declare class StringContaining extends AsymmetricMatcher<string> {
39
+ constructor(sample: string, inverse?: boolean);
40
+ asymmetricMatch(other: string): boolean;
41
+ toString(): string;
42
+ getExpectedType(): string;
43
+ }
44
+ declare class Anything extends AsymmetricMatcher<void> {
45
+ asymmetricMatch(other: unknown): boolean;
46
+ toString(): string;
47
+ toAsymmetricMatcher(): string;
48
+ }
49
+ declare class ObjectContaining extends AsymmetricMatcher<Record<string | symbol | number, unknown>> {
50
+ constructor(sample: Record<string, unknown>, inverse?: boolean);
51
+ getPrototype(obj: object): any;
52
+ hasProperty(obj: object | null, property: string | symbol): boolean;
53
+ getProperties(obj: object): (string | symbol)[];
54
+ asymmetricMatch(other: any, customTesters?: Array<Tester>): boolean;
55
+ toString(): string;
56
+ getExpectedType(): string;
57
+ }
58
+ declare class ArrayContaining<T = unknown> extends AsymmetricMatcher<Array<T>> {
59
+ constructor(sample: Array<T>, inverse?: boolean);
60
+ asymmetricMatch(other: Array<T>, customTesters?: Array<Tester>): boolean;
61
+ toString(): string;
62
+ getExpectedType(): string;
63
+ }
64
+ declare class Any extends AsymmetricMatcher<any> {
65
+ constructor(sample: unknown);
66
+ fnNameFor(func: Function): string;
67
+ asymmetricMatch(other: unknown): boolean;
68
+ toString(): string;
69
+ getExpectedType(): string;
70
+ toAsymmetricMatcher(): string;
71
+ }
72
+ declare class StringMatching extends AsymmetricMatcher<RegExp> {
73
+ constructor(sample: string | RegExp, inverse?: boolean);
74
+ asymmetricMatch(other: string): boolean;
75
+ toString(): string;
76
+ getExpectedType(): string;
77
+ }
78
+ declare class SchemaMatching extends AsymmetricMatcher<StandardSchemaV1<unknown, unknown>> {
79
+ private result;
80
+ constructor(sample: StandardSchemaV1<unknown, unknown>, inverse?: boolean);
81
+ asymmetricMatch(other: unknown): boolean;
82
+ toString(): string;
83
+ getExpectedType(): string;
84
+ toAsymmetricMatcher(): string;
85
+ }
86
+ declare const JestAsymmetricMatchers: ChaiPlugin;
87
+
88
+ declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
89
+ declare function printReceived(object: unknown): string;
90
+ declare function printExpected(value: unknown): string;
91
+ declare function getMatcherUtils(): {
92
+ EXPECTED_COLOR: Formatter;
93
+ RECEIVED_COLOR: Formatter;
94
+ INVERTED_COLOR: Formatter;
95
+ BOLD_WEIGHT: Formatter;
96
+ DIM_COLOR: Formatter;
97
+ diff: typeof diff;
98
+ matcherHint: typeof matcherHint;
99
+ printReceived: typeof printReceived;
100
+ printExpected: typeof printExpected;
101
+ printDiffOrStringify: typeof printDiffOrStringify;
102
+ printWithType: typeof printWithType;
103
+ };
104
+ declare function printWithType<T>(name: string, value: T, print: (value: T) => string): string;
105
+ declare function addCustomEqualityTesters(newTesters: Array<Tester>): void;
106
+
107
+ /**
108
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
109
+ *
110
+ * This source code is licensed under the MIT license found in the
111
+ * LICENSE file in the root directory of this source tree.
112
+ *
113
+ */
114
+
115
+ type ChaiPlugin = Chai.ChaiPlugin;
116
+ type Tester = (this: TesterContext, a: any, b: any, customTesters: Array<Tester>) => boolean | undefined;
117
+ interface TesterContext {
118
+ equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
119
+ }
120
+
121
+ interface MatcherHintOptions {
122
+ comment?: string;
123
+ expectedColor?: Formatter;
124
+ isDirectExpectCall?: boolean;
125
+ isNot?: boolean;
126
+ promise?: string;
127
+ receivedColor?: Formatter;
128
+ secondArgument?: string;
129
+ secondArgumentColor?: Formatter;
130
+ }
131
+ interface MatcherState {
132
+ customTesters: Array<Tester>;
133
+ assertionCalls: number;
134
+ currentTestName?: string;
135
+ dontThrow?: () => void;
136
+ error?: Error;
137
+ equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
138
+ expand?: boolean;
139
+ expectedAssertionsNumber?: number | null;
140
+ expectedAssertionsNumberErrorGen?: (() => Error) | null;
141
+ isExpectingAssertions?: boolean;
142
+ isExpectingAssertionsError?: Error | null;
143
+ isNot: boolean;
144
+ promise: string;
145
+ suppressedErrors: Array<Error>;
146
+ testPath?: string;
147
+ utils: ReturnType<typeof getMatcherUtils> & {
148
+ diff: typeof diff;
149
+ stringify: typeof stringify;
150
+ iterableEquality: Tester;
151
+ subsetEquality: Tester;
152
+ };
153
+ soft?: boolean;
154
+ poll?: boolean;
155
+ task?: Readonly<Test>;
156
+ }
157
+ interface SyncExpectationResult {
158
+ pass: boolean;
159
+ message: () => string;
160
+ actual?: any;
161
+ expected?: any;
162
+ }
163
+ type AsyncExpectationResult = Promise<SyncExpectationResult>;
164
+ type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
165
+ interface RawMatcherFn<
166
+ T extends MatcherState = MatcherState,
167
+ E extends Array<any> = Array<any>
168
+ > {
169
+ (this: T, received: any, ...expected: E): ExpectationResult;
170
+ }
171
+ interface Matchers<T = any> {}
172
+ type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>> & ThisType<T> & { [K in keyof Matchers<T>]? : RawMatcherFn<T, Parameters<Matchers<T>[K]>> };
173
+ interface ExpectStatic extends Chai.ExpectStatic, Matchers, AsymmetricMatchersContaining {
174
+ <T>(actual: T, message?: string): Assertion<T>;
175
+ extend: (expects: MatchersObject) => void;
176
+ anything: () => any;
177
+ any: (constructor: unknown) => any;
178
+ getState: () => MatcherState;
179
+ setState: (state: Partial<MatcherState>) => void;
180
+ not: AsymmetricMatchersContaining;
181
+ }
182
+ interface CustomMatcher {
183
+ /**
184
+ * Checks that a value satisfies a custom matcher function.
185
+ *
186
+ * @param matcher - A function returning a boolean based on the custom condition
187
+ * @param message - Optional custom error message on failure
188
+ *
189
+ * @example
190
+ * expect(age).toSatisfy(val => val >= 18, 'Age must be at least 18');
191
+ * expect(age).toEqual(expect.toSatisfy(val => val >= 18, 'Age must be at least 18'));
192
+ */
193
+ toSatisfy: (matcher: (value: any) => boolean, message?: string) => any;
194
+ /**
195
+ * Matches if the received value is one of the values in the expected array or set.
196
+ *
197
+ * @example
198
+ * expect(1).toBeOneOf([1, 2, 3])
199
+ * expect('foo').toBeOneOf([expect.any(String)])
200
+ * expect({ a: 1 }).toEqual({ a: expect.toBeOneOf(['1', '2', '3']) })
201
+ */
202
+ toBeOneOf: <T>(sample: Array<T> | Set<T>) => any;
203
+ }
204
+ interface AsymmetricMatchersContaining extends CustomMatcher {
205
+ /**
206
+ * Matches if the received string contains the expected substring.
207
+ *
208
+ * @example
209
+ * expect('I have an apple').toEqual(expect.stringContaining('apple'));
210
+ * expect({ a: 'test string' }).toEqual({ a: expect.stringContaining('test') });
211
+ */
212
+ stringContaining: (expected: string) => any;
213
+ /**
214
+ * Matches if the received object contains all properties of the expected object.
215
+ *
216
+ * @example
217
+ * expect({ a: '1', b: 2 }).toEqual(expect.objectContaining({ a: '1' }))
218
+ */
219
+ objectContaining: <T = any>(expected: DeeplyAllowMatchers<T>) => any;
220
+ /**
221
+ * Matches if the received array contains all elements in the expected array.
222
+ *
223
+ * @example
224
+ * expect(['a', 'b', 'c']).toEqual(expect.arrayContaining(['b', 'a']));
225
+ */
226
+ arrayContaining: <T = unknown>(expected: Array<DeeplyAllowMatchers<T>>) => any;
227
+ /**
228
+ * Matches if the received string or regex matches the expected pattern.
229
+ *
230
+ * @example
231
+ * expect('hello world').toEqual(expect.stringMatching(/^hello/));
232
+ * expect('hello world').toEqual(expect.stringMatching('hello'));
233
+ */
234
+ stringMatching: (expected: string | RegExp) => any;
235
+ /**
236
+ * Matches if the received number is within a certain precision of the expected number.
237
+ *
238
+ * @param precision - Optional decimal precision for comparison. Default is 2.
239
+ *
240
+ * @example
241
+ * expect(10.45).toEqual(expect.closeTo(10.5, 1));
242
+ * expect(5.11).toEqual(expect.closeTo(5.12)); // with default precision
243
+ */
244
+ closeTo: (expected: number, precision?: number) => any;
245
+ /**
246
+ * Matches if the received value validates against a Standard Schema.
247
+ *
248
+ * @param schema - A Standard Schema V1 compatible schema object
249
+ *
250
+ * @example
251
+ * expect(user).toEqual(expect.schemaMatching(z.object({ name: z.string() })))
252
+ * expect(['hello', 'world']).toEqual([expect.schemaMatching(z.string()), expect.schemaMatching(z.string())])
253
+ */
254
+ schemaMatching: (schema: unknown) => any;
255
+ }
256
+ type WithAsymmetricMatcher<T> = T | AsymmetricMatcher<unknown>;
257
+ type DeeplyAllowMatchers<T> = T extends Array<infer Element> ? WithAsymmetricMatcher<T> | DeeplyAllowMatchers<Element>[] : T extends object ? WithAsymmetricMatcher<T> | { [K in keyof T] : DeeplyAllowMatchers<T[K]> } : WithAsymmetricMatcher<T>;
258
+ interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMatcher {
259
+ /**
260
+ * Used when you want to check that two objects have the same value.
261
+ * This matcher recursively checks the equality of all fields, rather than checking for object identity.
262
+ *
263
+ * @example
264
+ * expect(user).toEqual({ name: 'Alice', age: 30 });
265
+ */
266
+ toEqual: <E>(expected: E) => void;
267
+ /**
268
+ * Use to test that objects have the same types as well as structure.
269
+ *
270
+ * @example
271
+ * expect(user).toStrictEqual({ name: 'Alice', age: 30 });
272
+ */
273
+ toStrictEqual: <E>(expected: E) => void;
274
+ /**
275
+ * Checks that a value is what you expect. It calls `Object.is` to compare values.
276
+ * Don't use `toBe` with floating-point numbers.
277
+ *
278
+ * @example
279
+ * expect(result).toBe(42);
280
+ * expect(status).toBe(true);
281
+ */
282
+ toBe: <E>(expected: E) => void;
283
+ /**
284
+ * Check that a string matches a regular expression.
285
+ *
286
+ * @example
287
+ * expect(message).toMatch(/hello/);
288
+ * expect(greeting).toMatch('world');
289
+ */
290
+ toMatch: (expected: string | RegExp) => void;
291
+ /**
292
+ * Used to check that a JavaScript object matches a subset of the properties of an object
293
+ *
294
+ * @example
295
+ * expect(user).toMatchObject({
296
+ * name: 'Alice',
297
+ * address: { city: 'Wonderland' }
298
+ * });
299
+ */
300
+ toMatchObject: <E extends object | any[]>(expected: E) => void;
301
+ /**
302
+ * Used when you want to check that an item is in a list.
303
+ * For testing the items in the list, this uses `===`, a strict equality check.
304
+ *
305
+ * @example
306
+ * expect(items).toContain('apple');
307
+ * expect(numbers).toContain(5);
308
+ */
309
+ toContain: <E>(item: E) => void;
310
+ /**
311
+ * Used when you want to check that an item is in a list.
312
+ * For testing the items in the list, this matcher recursively checks the
313
+ * equality of all fields, rather than checking for object identity.
314
+ *
315
+ * @example
316
+ * expect(items).toContainEqual({ name: 'apple', quantity: 1 });
317
+ */
318
+ toContainEqual: <E>(item: E) => void;
319
+ /**
320
+ * Use when you don't care what a value is, you just want to ensure a value
321
+ * is true in a boolean context. In JavaScript, there are six falsy values:
322
+ * `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy.
323
+ *
324
+ * @example
325
+ * expect(user.isActive).toBeTruthy();
326
+ */
327
+ toBeTruthy: () => void;
328
+ /**
329
+ * When you don't care what a value is, you just want to
330
+ * ensure a value is false in a boolean context.
331
+ *
332
+ * @example
333
+ * expect(user.isActive).toBeFalsy();
334
+ */
335
+ toBeFalsy: () => void;
336
+ /**
337
+ * For comparing floating point numbers.
338
+ *
339
+ * @example
340
+ * expect(score).toBeGreaterThan(10);
341
+ */
342
+ toBeGreaterThan: (num: number | bigint) => void;
343
+ /**
344
+ * For comparing floating point numbers.
345
+ *
346
+ * @example
347
+ * expect(score).toBeGreaterThanOrEqual(10);
348
+ */
349
+ toBeGreaterThanOrEqual: (num: number | bigint) => void;
350
+ /**
351
+ * For comparing floating point numbers.
352
+ *
353
+ * @example
354
+ * expect(score).toBeLessThan(10);
355
+ */
356
+ toBeLessThan: (num: number | bigint) => void;
357
+ /**
358
+ * For comparing floating point numbers.
359
+ *
360
+ * @example
361
+ * expect(score).toBeLessThanOrEqual(10);
362
+ */
363
+ toBeLessThanOrEqual: (num: number | bigint) => void;
364
+ /**
365
+ * Used to check that a variable is NaN.
366
+ *
367
+ * @example
368
+ * expect(value).toBeNaN();
369
+ */
370
+ toBeNaN: () => void;
371
+ /**
372
+ * Used to check that a variable is undefined.
373
+ *
374
+ * @example
375
+ * expect(value).toBeUndefined();
376
+ */
377
+ toBeUndefined: () => void;
378
+ /**
379
+ * This is the same as `.toBe(null)` but the error messages are a bit nicer.
380
+ * So use `.toBeNull()` when you want to check that something is null.
381
+ *
382
+ * @example
383
+ * expect(value).toBeNull();
384
+ */
385
+ toBeNull: () => void;
386
+ /**
387
+ * Used to check that a variable is nullable (null or undefined).
388
+ *
389
+ * @example
390
+ * expect(value).toBeNullable();
391
+ */
392
+ toBeNullable: () => void;
393
+ /**
394
+ * Ensure that a variable is not undefined.
395
+ *
396
+ * @example
397
+ * expect(value).toBeDefined();
398
+ */
399
+ toBeDefined: () => void;
400
+ /**
401
+ * Ensure that an object is an instance of a class.
402
+ * This matcher uses `instanceof` underneath.
403
+ *
404
+ * @example
405
+ * expect(new Date()).toBeInstanceOf(Date);
406
+ */
407
+ toBeInstanceOf: <E>(expected: E) => void;
408
+ /**
409
+ * Used to check that an object has a `.length` property
410
+ * and it is set to a certain numeric value.
411
+ *
412
+ * @example
413
+ * expect([1, 2, 3]).toHaveLength(3);
414
+ * expect('hello').toHaveLength(5);
415
+ */
416
+ toHaveLength: (length: number) => void;
417
+ /**
418
+ * Use to check if a property at the specified path exists on an object.
419
+ * For checking deeply nested properties, you may use dot notation or an array containing
420
+ * the path segments for deep references.
421
+ *
422
+ * Optionally, you can provide a value to check if it matches the value present at the path
423
+ * on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks
424
+ * the equality of all fields.
425
+ *
426
+ * @example
427
+ * expect(user).toHaveProperty('address.city', 'New York');
428
+ * expect(config).toHaveProperty(['settings', 'theme'], 'dark');
429
+ */
430
+ toHaveProperty: <E>(property: string | (string | number)[], value?: E) => void;
431
+ /**
432
+ * Using exact equality with floating point numbers is a bad idea.
433
+ * Rounding means that intuitive things fail.
434
+ * The default for `numDigits` is 2.
435
+ *
436
+ * @example
437
+ * expect(price).toBeCloseTo(9.99, 2);
438
+ */
439
+ toBeCloseTo: (number: number, numDigits?: number) => void;
440
+ /**
441
+ * Ensures that a mock function is called an exact number of times.
442
+ *
443
+ * Also under the alias `expect.toBeCalledTimes`.
444
+ *
445
+ * @example
446
+ * expect(mockFunc).toHaveBeenCalledTimes(2);
447
+ */
448
+ toHaveBeenCalledTimes: (times: number) => void;
449
+ /**
450
+ * Ensures that a mock function is called an exact number of times.
451
+ *
452
+ * Alias for `expect.toHaveBeenCalledTimes`.
453
+ *
454
+ * @example
455
+ * expect(mockFunc).toBeCalledTimes(2);
456
+ */
457
+ toBeCalledTimes: (times: number) => void;
458
+ /**
459
+ * Ensures that a mock function is called.
460
+ *
461
+ * Also under the alias `expect.toBeCalled`.
462
+ *
463
+ * @example
464
+ * expect(mockFunc).toHaveBeenCalled();
465
+ */
466
+ toHaveBeenCalled: () => void;
467
+ /**
468
+ * Ensures that a mock function is called.
469
+ *
470
+ * Alias for `expect.toHaveBeenCalled`.
471
+ *
472
+ * @example
473
+ * expect(mockFunc).toBeCalled();
474
+ */
475
+ toBeCalled: () => void;
476
+ /**
477
+ * Ensure that a mock function is called with specific arguments.
478
+ *
479
+ * Also under the alias `expect.toBeCalledWith`.
480
+ *
481
+ * @example
482
+ * expect(mockFunc).toHaveBeenCalledWith('arg1', 42);
483
+ */
484
+ toHaveBeenCalledWith: <E extends any[]>(...args: E) => void;
485
+ /**
486
+ * Ensure that a mock function is called with specific arguments.
487
+ *
488
+ * Alias for `expect.toHaveBeenCalledWith`.
489
+ *
490
+ * @example
491
+ * expect(mockFunc).toBeCalledWith('arg1', 42);
492
+ */
493
+ toBeCalledWith: <E extends any[]>(...args: E) => void;
494
+ /**
495
+ * Ensure that a mock function is called with specific arguments on an Nth call.
496
+ *
497
+ * Also under the alias `expect.nthCalledWith`.
498
+ *
499
+ * @example
500
+ * expect(mockFunc).toHaveBeenNthCalledWith(2, 'secondArg');
501
+ */
502
+ toHaveBeenNthCalledWith: <E extends any[]>(n: number, ...args: E) => void;
503
+ /**
504
+ * Ensure that a mock function is called with specific arguments on an Nth call.
505
+ *
506
+ * Alias for `expect.toHaveBeenNthCalledWith`.
507
+ *
508
+ * @example
509
+ * expect(mockFunc).nthCalledWith(2, 'secondArg');
510
+ */
511
+ nthCalledWith: <E extends any[]>(nthCall: number, ...args: E) => void;
512
+ /**
513
+ * If you have a mock function, you can use `.toHaveBeenLastCalledWith`
514
+ * to test what arguments it was last called with.
515
+ *
516
+ * Also under the alias `expect.lastCalledWith`.
517
+ *
518
+ * @example
519
+ * expect(mockFunc).toHaveBeenLastCalledWith('lastArg');
520
+ */
521
+ toHaveBeenLastCalledWith: <E extends any[]>(...args: E) => void;
522
+ /**
523
+ * If you have a mock function, you can use `.lastCalledWith`
524
+ * to test what arguments it was last called with.
525
+ *
526
+ * Alias for `expect.toHaveBeenLastCalledWith`.
527
+ *
528
+ * @example
529
+ * expect(mockFunc).lastCalledWith('lastArg');
530
+ */
531
+ lastCalledWith: <E extends any[]>(...args: E) => void;
532
+ /**
533
+ * Used to test that a function throws when it is called.
534
+ *
535
+ * Also under the alias `expect.toThrowError`.
536
+ *
537
+ * @example
538
+ * expect(() => functionWithError()).toThrow('Error message');
539
+ * expect(() => parseJSON('invalid')).toThrow(SyntaxError);
540
+ */
541
+ toThrow: (expected?: string | Constructable | RegExp | Error) => void;
542
+ /**
543
+ * Used to test that a function throws when it is called.
544
+ *
545
+ * Alias for `expect.toThrow`.
546
+ *
547
+ * @example
548
+ * expect(() => functionWithError()).toThrowError('Error message');
549
+ * expect(() => parseJSON('invalid')).toThrowError(SyntaxError);
550
+ */
551
+ toThrowError: (expected?: string | Constructable | RegExp | Error) => void;
552
+ /**
553
+ * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
554
+ *
555
+ * Alias for `expect.toHaveReturned`.
556
+ *
557
+ * @example
558
+ * expect(mockFunc).toReturn();
559
+ */
560
+ toReturn: () => void;
561
+ /**
562
+ * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
563
+ *
564
+ * Also under the alias `expect.toReturn`.
565
+ *
566
+ * @example
567
+ * expect(mockFunc).toHaveReturned();
568
+ */
569
+ toHaveReturned: () => void;
570
+ /**
571
+ * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
572
+ * Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
573
+ *
574
+ * Alias for `expect.toHaveReturnedTimes`.
575
+ *
576
+ * @example
577
+ * expect(mockFunc).toReturnTimes(3);
578
+ */
579
+ toReturnTimes: (times: number) => void;
580
+ /**
581
+ * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
582
+ * Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
583
+ *
584
+ * Also under the alias `expect.toReturnTimes`.
585
+ *
586
+ * @example
587
+ * expect(mockFunc).toHaveReturnedTimes(3);
588
+ */
589
+ toHaveReturnedTimes: (times: number) => void;
590
+ /**
591
+ * Use to ensure that a mock function returned a specific value.
592
+ *
593
+ * Alias for `expect.toHaveReturnedWith`.
594
+ *
595
+ * @example
596
+ * expect(mockFunc).toReturnWith('returnValue');
597
+ */
598
+ toReturnWith: <E>(value: E) => void;
599
+ /**
600
+ * Use to ensure that a mock function returned a specific value.
601
+ *
602
+ * Also under the alias `expect.toReturnWith`.
603
+ *
604
+ * @example
605
+ * expect(mockFunc).toHaveReturnedWith('returnValue');
606
+ */
607
+ toHaveReturnedWith: <E>(value: E) => void;
608
+ /**
609
+ * Use to test the specific value that a mock function last returned.
610
+ * If the last call to the mock function threw an error, then this matcher will fail
611
+ * no matter what value you provided as the expected return value.
612
+ *
613
+ * Also under the alias `expect.lastReturnedWith`.
614
+ *
615
+ * @example
616
+ * expect(mockFunc).toHaveLastReturnedWith('lastValue');
617
+ */
618
+ toHaveLastReturnedWith: <E>(value: E) => void;
619
+ /**
620
+ * Use to test the specific value that a mock function last returned.
621
+ * If the last call to the mock function threw an error, then this matcher will fail
622
+ * no matter what value you provided as the expected return value.
623
+ *
624
+ * Alias for `expect.toHaveLastReturnedWith`.
625
+ *
626
+ * @example
627
+ * expect(mockFunc).lastReturnedWith('lastValue');
628
+ */
629
+ lastReturnedWith: <E>(value: E) => void;
630
+ /**
631
+ * Use to test the specific value that a mock function returned for the nth call.
632
+ * If the nth call to the mock function threw an error, then this matcher will fail
633
+ * no matter what value you provided as the expected return value.
634
+ *
635
+ * Also under the alias `expect.nthReturnedWith`.
636
+ *
637
+ * @example
638
+ * expect(mockFunc).toHaveNthReturnedWith(2, 'nthValue');
639
+ */
640
+ toHaveNthReturnedWith: <E>(nthCall: number, value: E) => void;
641
+ /**
642
+ * Use to test the specific value that a mock function returned for the nth call.
643
+ * If the nth call to the mock function threw an error, then this matcher will fail
644
+ * no matter what value you provided as the expected return value.
645
+ *
646
+ * Alias for `expect.toHaveNthReturnedWith`.
647
+ *
648
+ * @example
649
+ * expect(mockFunc).nthReturnedWith(2, 'nthValue');
650
+ */
651
+ nthReturnedWith: <E>(nthCall: number, value: E) => void;
652
+ }
653
+ type VitestAssertion<
654
+ A,
655
+ T
656
+ > = { [K in keyof A] : A[K] extends Chai.Assertion ? Assertion<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T> } & ((type: string, message?: string) => Assertion);
657
+ type Promisify<O> = { [K in keyof O] : O[K] extends (...args: infer A) => infer R ? Promisify<O[K]> & ((...args: A) => Promise<R>) : O[K] };
658
+ type PromisifyAssertion<T> = Promisify<Assertion<T>>;
659
+ interface Assertion<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<T>, Matchers<T> {
660
+ /**
661
+ * Ensures a value is of a specific type.
662
+ *
663
+ * @example
664
+ * expect(value).toBeTypeOf('string');
665
+ * expect(number).toBeTypeOf('number');
666
+ */
667
+ toBeTypeOf: (expected: "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined") => void;
668
+ /**
669
+ * Asserts that a mock function was called exactly once.
670
+ *
671
+ * @example
672
+ * expect(mockFunc).toHaveBeenCalledOnce();
673
+ */
674
+ toHaveBeenCalledOnce: () => void;
675
+ /**
676
+ * Ensure that a mock function is called with specific arguments and called
677
+ * exactly once.
678
+ *
679
+ * @example
680
+ * expect(mockFunc).toHaveBeenCalledExactlyOnceWith('arg1', 42);
681
+ */
682
+ toHaveBeenCalledExactlyOnceWith: <E extends any[]>(...args: E) => void;
683
+ /**
684
+ * This assertion checks if a `Mock` was called before another `Mock`.
685
+ * @param mock - A mock function created by `vi.spyOn` or `vi.fn`
686
+ * @param failIfNoFirstInvocation - Fail if the first mock was never called
687
+ * @example
688
+ * const mock1 = vi.fn()
689
+ * const mock2 = vi.fn()
690
+ *
691
+ * mock1()
692
+ * mock2()
693
+ * mock1()
694
+ *
695
+ * expect(mock1).toHaveBeenCalledBefore(mock2)
696
+ */
697
+ toHaveBeenCalledBefore: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => void;
698
+ /**
699
+ * This assertion checks if a `Mock` was called after another `Mock`.
700
+ * @param mock - A mock function created by `vi.spyOn` or `vi.fn`
701
+ * @param failIfNoFirstInvocation - Fail if the first mock was never called
702
+ * @example
703
+ * const mock1 = vi.fn()
704
+ * const mock2 = vi.fn()
705
+ *
706
+ * mock2()
707
+ * mock1()
708
+ * mock2()
709
+ *
710
+ * expect(mock1).toHaveBeenCalledAfter(mock2)
711
+ */
712
+ toHaveBeenCalledAfter: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => void;
713
+ /**
714
+ * Checks that a promise resolves successfully at least once.
715
+ *
716
+ * @example
717
+ * await expect(promise).toHaveResolved();
718
+ */
719
+ toHaveResolved: () => void;
720
+ /**
721
+ * Checks that a promise resolves to a specific value.
722
+ *
723
+ * @example
724
+ * await expect(promise).toHaveResolvedWith('success');
725
+ */
726
+ toHaveResolvedWith: <E>(value: E) => void;
727
+ /**
728
+ * Ensures a promise resolves a specific number of times.
729
+ *
730
+ * @example
731
+ * expect(mockAsyncFunc).toHaveResolvedTimes(3);
732
+ */
733
+ toHaveResolvedTimes: (times: number) => void;
734
+ /**
735
+ * Asserts that the last resolved value of a promise matches an expected value.
736
+ *
737
+ * @example
738
+ * await expect(mockAsyncFunc).toHaveLastResolvedWith('finalResult');
739
+ */
740
+ toHaveLastResolvedWith: <E>(value: E) => void;
741
+ /**
742
+ * Ensures a specific value was returned by a promise on the nth resolution.
743
+ *
744
+ * @example
745
+ * await expect(mockAsyncFunc).toHaveNthResolvedWith(2, 'secondResult');
746
+ */
747
+ toHaveNthResolvedWith: <E>(nthCall: number, value: E) => void;
748
+ /**
749
+ * Verifies that a promise resolves.
750
+ *
751
+ * @example
752
+ * await expect(someAsyncFunc).resolves.toBe(42);
753
+ */
754
+ resolves: PromisifyAssertion<T>;
755
+ /**
756
+ * Verifies that a promise rejects.
757
+ *
758
+ * @example
759
+ * await expect(someAsyncFunc).rejects.toThrow('error');
760
+ */
761
+ rejects: PromisifyAssertion<T>;
762
+ }
763
+ declare global {
764
+ namespace jest {
765
+ interface Matchers<
766
+ R,
767
+ T = {}
768
+ > {}
769
+ }
770
+ }
771
+
772
+ declare const customMatchers: MatchersObject;
773
+
774
+ declare const JestChaiExpect: ChaiPlugin;
775
+
776
+ declare const JestExtend: ChaiPlugin;
777
+
778
+ declare function equals(a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean): boolean;
779
+ declare function isAsymmetric(obj: any): obj is AsymmetricMatcher<any>;
780
+ declare function hasAsymmetric(obj: any, seen?: Set<any>): boolean;
781
+ declare function isA(typeName: string, value: unknown): boolean;
782
+ declare function fnNameFor(func: Function): string;
783
+ declare function hasProperty(obj: object | null, property: string): boolean;
784
+ declare function isImmutableUnorderedKeyed(maybeKeyed: any): boolean;
785
+ declare function isImmutableUnorderedSet(maybeSet: any): boolean;
786
+ declare function iterableEquality(a: any, b: any, customTesters?: Array<Tester>, aStack?: Array<any>, bStack?: Array<any>): boolean | undefined;
787
+ declare function subsetEquality(object: unknown, subset: unknown, customTesters?: Array<Tester>): boolean | undefined;
788
+ declare function typeEquality(a: any, b: any): boolean | undefined;
789
+ declare function arrayBufferEquality(a: unknown, b: unknown): boolean | undefined;
790
+ declare function sparseArrayEquality(a: unknown, b: unknown, customTesters?: Array<Tester>): boolean | undefined;
791
+ declare function generateToBeMessage(deepEqualityName: string, expected?: string, actual?: string): string;
792
+ declare function pluralize(word: string, count: number): string;
793
+ declare function getObjectKeys(object: object): Array<string | symbol>;
794
+ declare function getObjectSubset(object: any, subset: any, customTesters: Array<Tester>): {
795
+ subset: any;
796
+ stripped: number;
797
+ };
798
+ /**
799
+ * Detects if an object is a Standard Schema V1 compatible schema
800
+ */
801
+ declare function isStandardSchema(obj: any): obj is StandardSchemaV1;
802
+
803
+ declare function getState<State extends MatcherState = MatcherState>(expect: ExpectStatic): State;
804
+ declare function setState<State extends MatcherState = MatcherState>(state: Partial<State>, expect: ExpectStatic): void;
805
+
806
+ export { ASYMMETRIC_MATCHERS_OBJECT, Any, Anything, ArrayContaining, AsymmetricMatcher, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, ObjectContaining, SchemaMatching, StringContaining, StringMatching, addCustomEqualityTesters, arrayBufferEquality, customMatchers, equals, fnNameFor, generateToBeMessage, getObjectKeys, getObjectSubset, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, isStandardSchema, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality };
807
+ export type { Assertion, AsymmetricMatcherInterface, AsymmetricMatchersContaining, AsyncExpectationResult, ChaiPlugin, DeeplyAllowMatchers, ExpectStatic, ExpectationResult, JestAssertion, MatcherHintOptions, MatcherState, Matchers, MatchersObject, PromisifyAssertion, RawMatcherFn, SyncExpectationResult, Tester, TesterContext };