vitest-auto-spy 5.66.0 → 5.68.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 (123) hide show
  1. package/AGENTS.md +10 -9
  2. package/CHANGELOG.md +363 -6877
  3. package/README.md +14 -3215
  4. package/agent-docs/angular.md +4 -0
  5. package/agent-docs/anti-patterns.md +2 -2
  6. package/agent-docs/checklist.md +10 -0
  7. package/agent-docs/configuration.md +4 -0
  8. package/agent-docs/doubles.md +21 -3
  9. package/agent-docs/errors.md +5 -2
  10. package/agent-docs/eslint.md +8 -8
  11. package/agent-docs/migration-jasmine.md +7 -0
  12. package/agent-docs/observables.md +6 -5
  13. package/agent-docs/return-helpers.md +43 -4
  14. package/agent-docs/setup.md +8 -4
  15. package/dist/angular-diagnostics.js +12 -14
  16. package/dist/angular-doubles.d.ts +2 -2
  17. package/dist/angular-doubles.js +69 -30
  18. package/dist/angular-http.js +9 -10
  19. package/dist/angular-matchers.js +28 -3
  20. package/dist/angular-router.d.ts +1 -1
  21. package/dist/angular-router.js +7 -7
  22. package/dist/angular.d.ts +14 -8
  23. package/dist/angular.js +161 -68
  24. package/dist/bun-angular.d.ts +7 -6
  25. package/dist/bun-angular.js +230 -62
  26. package/dist/bun.d.ts +6 -5
  27. package/dist/bun.js +11 -14
  28. package/dist/{chunk-C7K75NLS.js → chunk-36QDG3LW.js} +27 -27
  29. package/dist/{chunk-EZTP5VUF.js → chunk-3AE452K7.js} +4 -4
  30. package/dist/{chunk-DCCURN7I.js → chunk-65TO7RTV.js} +3 -3
  31. package/dist/{chunk-HIGHZ4BW.js → chunk-7ONST5VQ.js} +163 -75
  32. package/dist/{chunk-XLKBJSYQ.js → chunk-BDPNXQIH.js} +495 -89
  33. package/dist/{chunk-2CWSOIBW.js → chunk-CG5DUJF4.js} +51 -42
  34. package/dist/{chunk-KCQOZSNA.js → chunk-FUSJ73SR.js} +77 -90
  35. package/dist/{chunk-7GOVSGXB.js → chunk-HND6UHRE.js} +35 -44
  36. package/dist/{chunk-XZS56XV5.js → chunk-IO4KGZ5B.js} +1 -1
  37. package/dist/{chunk-DYAS4OK4.js → chunk-M5SOOSQF.js} +5 -1
  38. package/dist/{chunk-7WU53KRS.js → chunk-NPSCPUGE.js} +2 -9
  39. package/dist/chunk-RG3STYX3.js +40 -0
  40. package/dist/{chunk-OXE6FCQX.js → chunk-RQYTDYJ5.js} +13 -8
  41. package/dist/{chunk-PS6UQC4C.js → chunk-VRCAEBZV.js} +2 -2
  42. package/dist/chunk-WFSAQCBM.js +15 -0
  43. package/dist/{chunk-SF4GKKN4.js → chunk-ZX3MQB7W.js} +1 -1
  44. package/dist/{chunk-EZKDQ4WO.js → chunk-ZYOCFL3E.js} +1 -1
  45. package/dist/cli-27FFYF3X.js +37 -0
  46. package/dist/cli-2RAZK7PT.js +3 -0
  47. package/dist/cli-3IP2U4X3.js +3 -0
  48. package/dist/cli-45YUTGOS.js +10 -0
  49. package/dist/cli-6OGAT2WC.js +3 -0
  50. package/dist/cli-77OHOFJE.js +2 -0
  51. package/dist/cli-BVSWOGM4.js +2 -0
  52. package/dist/cli-CEX3MAIK.js +2 -0
  53. package/dist/cli-DKD5FUCL.js +58 -0
  54. package/dist/cli-EH6SQSRG.js +2 -0
  55. package/dist/cli-GFSMIIPJ.js +11 -0
  56. package/dist/cli-HSVPZPXW.js +2 -0
  57. package/dist/cli-KAVWSADU.js +2 -0
  58. package/dist/cli-KDIEX2B5.js +2 -0
  59. package/dist/cli-KG2RCNLP.js +2 -0
  60. package/dist/cli-LKWY3YW7.js +41 -0
  61. package/dist/cli-LLUOKL65.js +6 -0
  62. package/dist/cli-MR3RTLWH.js +7 -0
  63. package/dist/cli-NLRIRLRR.js +2 -0
  64. package/dist/cli-P76X2CLG.js +12 -0
  65. package/dist/cli-QZJLWKUS.js +16 -0
  66. package/dist/cli-WXGJTIKT.js +3 -0
  67. package/dist/cli.js +31 -8475
  68. package/dist/console.d.ts +1 -1
  69. package/dist/console.js +2155 -13
  70. package/dist/core.d.ts +70 -66
  71. package/dist/diagnostics.js +50 -9
  72. package/dist/dom-stubs.d.ts +25 -6
  73. package/dist/dom-stubs.js +108 -3
  74. package/dist/{element-stub-D3kchFNq.d.ts → element-stub-BTMxHPkE.d.ts} +1 -1
  75. package/dist/{emission-positive-sync-BrSc2lb-.d.ts → emission-positive-sync-rtjliUbA.d.ts} +5 -2
  76. package/dist/eslint-plugin.cjs +17 -7260
  77. package/dist/eslint-plugin.d.ts +7 -0
  78. package/dist/index.d.ts +5 -4
  79. package/dist/index.js +429 -244
  80. package/dist/internal-types-DeUmtVVg.d.ts +16 -0
  81. package/dist/jasmine-compat.d.ts +14 -9
  82. package/dist/jasmine-compat.js +185 -3
  83. package/dist/jasmine.d.ts +48 -6
  84. package/dist/jasmine.js +270 -35
  85. package/dist/{nest-unit-DyDDZMOm.d.ts → nest-unit-DN7p-5ql.d.ts} +1 -1
  86. package/dist/nestjs.d.ts +5 -4
  87. package/dist/nestjs.js +3720 -18
  88. package/dist/node.cjs +425 -243
  89. package/dist/node.d.ts +6 -5
  90. package/dist/node.js +425 -243
  91. package/dist/observer-spy.d.ts +2 -2
  92. package/dist/observer-spy.js +13 -3
  93. package/dist/{package-identity-xpq8sPYM.d.ts → package-identity-nva6DWMA.d.ts} +1 -1
  94. package/dist/perf-profiler.js +6 -3
  95. package/dist/perf-reporter.js +4 -1
  96. package/dist/{prop-mock-424cOHvI.d.ts → prop-mock-BGB6BYca.d.ts} +1 -1
  97. package/dist/react.d.ts +5 -4
  98. package/dist/rstest.d.ts +5 -4
  99. package/dist/rstest.js +11 -13
  100. package/dist/rxjs.d.ts +3 -3
  101. package/dist/rxjs.js +89 -14
  102. package/dist/setup.d.ts +33 -12
  103. package/dist/setup.js +200 -87
  104. package/dist/signal-forms.js +1 -1
  105. package/dist/svelte.d.ts +5 -4
  106. package/dist/{track-injections-fmOmTK0q.d.ts → track-injections-D3xhvNmR.d.ts} +1 -1
  107. package/dist/{track-signal-runs-DLvVp9iI.d.ts → track-signal-runs-DBh_xS4i.d.ts} +8 -10
  108. package/dist/{types-BdYUK_Zv.d.ts → types-8gu6pNy6.d.ts} +61 -26
  109. package/dist/vue.d.ts +7 -6
  110. package/dist/zone.js +1 -1
  111. package/package.json +8 -1
  112. package/skills/vitest-auto-spy/SKILL.md +150 -146
  113. package/dist/chunk-5GKIQX65.js +0 -267
  114. package/dist/chunk-A2X7O5EP.js +0 -30
  115. package/dist/chunk-B6JUBFBA.js +0 -25
  116. package/dist/chunk-DWMIQ7VO.js +0 -38
  117. package/dist/chunk-IXARK3B6.js +0 -18
  118. package/dist/chunk-NMXLXBXH.js +0 -30
  119. package/dist/chunk-OIHOH2RY.js +0 -34
  120. package/dist/chunk-QATP6Q3G.js +0 -52
  121. package/dist/chunk-TRRI7TXE.js +0 -185
  122. package/dist/cli-BLEXQVAS.js +0 -820
  123. package/dist/cli-CJ767PUP.js +0 -2234
package/AGENTS.md CHANGED
@@ -106,7 +106,7 @@ Add-ons, orthogonal to the runner:
106
106
  | Signal forms | `vitest-auto-spy/signal-forms` | `createForm`, `registerFormMatchers` — a signal form built where `form()` can inject, and `toHaveFieldErrors` over what it produced (§13). Optional `@angular/forms` peer, this entry only; Angular 22+ |
107
107
  | Setup helpers | `vitest-auto-spy/setup` | `setupAutoSpy()`, `setupFakeTimers()`, `withFakeTimers()`, `blockNetwork()`, `stubResponse()`; the entry imports Vitest, so it is not for `bun test` |
108
108
  | Zone patch | `import 'vitest-auto-spy/zone'` | `fakeAsync` / `waitForAsync` on Vitest (§14) |
109
- | jasmine compat | `vitest-auto-spy/jasmine` | `.and` / `.calls` / `.withArgs`, the `jasmine` namespace (§20) |
109
+ | jasmine compat | `vitest-auto-spy/jasmine` | `.and` / `.calls` / `.withArgs`, the `jasmine` namespace — `addMatchers` included, taking jasmine's own factory shape (§20) |
110
110
 
111
111
  **Runner limits of two add-ons.** `/jasmine` and `/setup` import Vitest, so they are Vitest-only.
112
112
 
@@ -229,7 +229,7 @@ it('loads', async () => {
229
229
  | --- | --- | --- |
230
230
  | method returning a value | nothing | `spy.m.mockReturnValue(v)` or `spy.m.calledWith(args).mockReturnValue(v)` |
231
231
  | method returning `Promise<T>` | nothing | `spy.m.resolveWith(v)` / `rejectWith(e)` (§4) |
232
- | method returning `Observable<T>` | nothing | `spy.m.nextWith(v)` / `throwWith(e)` (§4, needs `/rxjs`) |
232
+ | method returning `Observable<T>` | nothing | one-shot (HTTP, IPC): `spy.m.nextOneTimeWith(v)`; a stream that stays open: `nextWith(v)`; `throwWith(e)` (§4, needs `/rxjs`) |
233
233
  | `Observable` property (`items$`) | `observablePropsToSpyOn: ['items$']` | `spy.items$.nextWith(v)` |
234
234
  | signal / `computed` member of a dependency | `instanceMethodsToSpyOn: ['items']` | `spy.items.mockReturnValue(v)`; a value that changes mid-test: `mockSignalProp` (§13) |
235
235
  | plain data field | `overrides: { field: value }` | set in the provider (§5) |
@@ -241,7 +241,9 @@ Rules that carry most of the value:
241
241
  2. **Declare each spy as `Spy<T>`, never as `T`** (§6).
242
242
  3. **Seed defaults in `beforeEach`, override in the test.** An unconfigured method returns
243
243
  `undefined`, and the failure surfaces far from its cause. Seed before `TestBed.inject(ClassUnderTest)`
244
- when its constructor or field initialisers read the dependency.
244
+ when its constructor or field initialisers read the dependency. Seed a one-shot `Observable` with
245
+ `nextOneTimeWith`: a `nextWith` never completes (`forkJoin` / `lastValueFrom` hang) and its buffered
246
+ value reaches a later `throwWith`'s subscriber first.
245
247
  4. **`provideAutoSpy` is lazy by default**, so listing a wide service costs nothing for the methods a
246
248
  test never touches.
247
249
  5. **Two import lines.** `provideAutoSpy`, `injectSpy` and the `Spy<T>` type come from
@@ -319,12 +321,11 @@ const modal = injectSpy<ModalRef<PurchaseOptions>>(ModalRef); // a particular in
319
321
  constructor takes the type parameter (`constructor(public data: T)`), it reads the **constraint**:
320
322
  `ModalRef<T = unknown>` gives `Spy<ModalRef<unknown>>`. Spell the argument out when the spec means
321
323
  the default or one instantiation.
322
- - `createSpyFromClass` needs the argument in one combination: a generic class with an accessor list
323
- (or `overrides`) **and** `returns`. The symptom: `'isKeyEnabled' does not exist in type
324
- 'MethodReturns<{ flagsConfig: any; }>'`. Write `createSpyFromClass<FlagsConfigService>(…)`. The
325
- core `registerAutoSpyDefaults` needs it the same way.
326
- - `provideAutoSpy`, `overrideAutoSpy`, `overrideComponentProvider` and the `/angular` class overload
327
- of `registerAutoSpyDefaults` take `T` from the class alone. A token needs nothing: `T` comes from
324
+ - `createSpyFromClass`, `createSpyFromInstance`, every `provideAutoSpy`, `overrideAutoSpy`,
325
+ `overrideComponentProvider` and both class overloads of `registerAutoSpyDefaults` take `T` from the
326
+ class alone: an accessor list, `returns` or an `overrides` object held in a variable no longer
327
+ narrows it, so `createSpyFromClass(KeyboardEvent, { overrides: keys, returnsUndefined: [...] })`
328
+ needs no `<KeyboardEvent>`. A token needs nothing: `T` comes from
328
329
  `InjectionToken<T>`.
329
330
 
330
331
  **A generic method collapses to `unknown`.** `show<T, U>(component: Type<T>, data: U)` types on the