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.
- package/AGENTS.md +10 -9
- package/CHANGELOG.md +363 -6877
- package/README.md +14 -3215
- package/agent-docs/angular.md +4 -0
- package/agent-docs/anti-patterns.md +2 -2
- package/agent-docs/checklist.md +10 -0
- package/agent-docs/configuration.md +4 -0
- package/agent-docs/doubles.md +21 -3
- package/agent-docs/errors.md +5 -2
- package/agent-docs/eslint.md +8 -8
- package/agent-docs/migration-jasmine.md +7 -0
- package/agent-docs/observables.md +6 -5
- package/agent-docs/return-helpers.md +43 -4
- package/agent-docs/setup.md +8 -4
- package/dist/angular-diagnostics.js +12 -14
- package/dist/angular-doubles.d.ts +2 -2
- package/dist/angular-doubles.js +69 -30
- package/dist/angular-http.js +9 -10
- package/dist/angular-matchers.js +28 -3
- package/dist/angular-router.d.ts +1 -1
- package/dist/angular-router.js +7 -7
- package/dist/angular.d.ts +14 -8
- package/dist/angular.js +161 -68
- package/dist/bun-angular.d.ts +7 -6
- package/dist/bun-angular.js +230 -62
- package/dist/bun.d.ts +6 -5
- package/dist/bun.js +11 -14
- package/dist/{chunk-C7K75NLS.js → chunk-36QDG3LW.js} +27 -27
- package/dist/{chunk-EZTP5VUF.js → chunk-3AE452K7.js} +4 -4
- package/dist/{chunk-DCCURN7I.js → chunk-65TO7RTV.js} +3 -3
- package/dist/{chunk-HIGHZ4BW.js → chunk-7ONST5VQ.js} +163 -75
- package/dist/{chunk-XLKBJSYQ.js → chunk-BDPNXQIH.js} +495 -89
- package/dist/{chunk-2CWSOIBW.js → chunk-CG5DUJF4.js} +51 -42
- package/dist/{chunk-KCQOZSNA.js → chunk-FUSJ73SR.js} +77 -90
- package/dist/{chunk-7GOVSGXB.js → chunk-HND6UHRE.js} +35 -44
- package/dist/{chunk-XZS56XV5.js → chunk-IO4KGZ5B.js} +1 -1
- package/dist/{chunk-DYAS4OK4.js → chunk-M5SOOSQF.js} +5 -1
- package/dist/{chunk-7WU53KRS.js → chunk-NPSCPUGE.js} +2 -9
- package/dist/chunk-RG3STYX3.js +40 -0
- package/dist/{chunk-OXE6FCQX.js → chunk-RQYTDYJ5.js} +13 -8
- package/dist/{chunk-PS6UQC4C.js → chunk-VRCAEBZV.js} +2 -2
- package/dist/chunk-WFSAQCBM.js +15 -0
- package/dist/{chunk-SF4GKKN4.js → chunk-ZX3MQB7W.js} +1 -1
- package/dist/{chunk-EZKDQ4WO.js → chunk-ZYOCFL3E.js} +1 -1
- package/dist/cli-27FFYF3X.js +37 -0
- package/dist/cli-2RAZK7PT.js +3 -0
- package/dist/cli-3IP2U4X3.js +3 -0
- package/dist/cli-45YUTGOS.js +10 -0
- package/dist/cli-6OGAT2WC.js +3 -0
- package/dist/cli-77OHOFJE.js +2 -0
- package/dist/cli-BVSWOGM4.js +2 -0
- package/dist/cli-CEX3MAIK.js +2 -0
- package/dist/cli-DKD5FUCL.js +58 -0
- package/dist/cli-EH6SQSRG.js +2 -0
- package/dist/cli-GFSMIIPJ.js +11 -0
- package/dist/cli-HSVPZPXW.js +2 -0
- package/dist/cli-KAVWSADU.js +2 -0
- package/dist/cli-KDIEX2B5.js +2 -0
- package/dist/cli-KG2RCNLP.js +2 -0
- package/dist/cli-LKWY3YW7.js +41 -0
- package/dist/cli-LLUOKL65.js +6 -0
- package/dist/cli-MR3RTLWH.js +7 -0
- package/dist/cli-NLRIRLRR.js +2 -0
- package/dist/cli-P76X2CLG.js +12 -0
- package/dist/cli-QZJLWKUS.js +16 -0
- package/dist/cli-WXGJTIKT.js +3 -0
- package/dist/cli.js +31 -8475
- package/dist/console.d.ts +1 -1
- package/dist/console.js +2155 -13
- package/dist/core.d.ts +70 -66
- package/dist/diagnostics.js +50 -9
- package/dist/dom-stubs.d.ts +25 -6
- package/dist/dom-stubs.js +108 -3
- package/dist/{element-stub-D3kchFNq.d.ts → element-stub-BTMxHPkE.d.ts} +1 -1
- package/dist/{emission-positive-sync-BrSc2lb-.d.ts → emission-positive-sync-rtjliUbA.d.ts} +5 -2
- package/dist/eslint-plugin.cjs +17 -7260
- package/dist/eslint-plugin.d.ts +7 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +429 -244
- package/dist/internal-types-DeUmtVVg.d.ts +16 -0
- package/dist/jasmine-compat.d.ts +14 -9
- package/dist/jasmine-compat.js +185 -3
- package/dist/jasmine.d.ts +48 -6
- package/dist/jasmine.js +270 -35
- package/dist/{nest-unit-DyDDZMOm.d.ts → nest-unit-DN7p-5ql.d.ts} +1 -1
- package/dist/nestjs.d.ts +5 -4
- package/dist/nestjs.js +3720 -18
- package/dist/node.cjs +425 -243
- package/dist/node.d.ts +6 -5
- package/dist/node.js +425 -243
- package/dist/observer-spy.d.ts +2 -2
- package/dist/observer-spy.js +13 -3
- package/dist/{package-identity-xpq8sPYM.d.ts → package-identity-nva6DWMA.d.ts} +1 -1
- package/dist/perf-profiler.js +6 -3
- package/dist/perf-reporter.js +4 -1
- package/dist/{prop-mock-424cOHvI.d.ts → prop-mock-BGB6BYca.d.ts} +1 -1
- package/dist/react.d.ts +5 -4
- package/dist/rstest.d.ts +5 -4
- package/dist/rstest.js +11 -13
- package/dist/rxjs.d.ts +3 -3
- package/dist/rxjs.js +89 -14
- package/dist/setup.d.ts +33 -12
- package/dist/setup.js +200 -87
- package/dist/signal-forms.js +1 -1
- package/dist/svelte.d.ts +5 -4
- package/dist/{track-injections-fmOmTK0q.d.ts → track-injections-D3xhvNmR.d.ts} +1 -1
- package/dist/{track-signal-runs-DLvVp9iI.d.ts → track-signal-runs-DBh_xS4i.d.ts} +8 -10
- package/dist/{types-BdYUK_Zv.d.ts → types-8gu6pNy6.d.ts} +61 -26
- package/dist/vue.d.ts +7 -6
- package/dist/zone.js +1 -1
- package/package.json +8 -1
- package/skills/vitest-auto-spy/SKILL.md +150 -146
- package/dist/chunk-5GKIQX65.js +0 -267
- package/dist/chunk-A2X7O5EP.js +0 -30
- package/dist/chunk-B6JUBFBA.js +0 -25
- package/dist/chunk-DWMIQ7VO.js +0 -38
- package/dist/chunk-IXARK3B6.js +0 -18
- package/dist/chunk-NMXLXBXH.js +0 -30
- package/dist/chunk-OIHOH2RY.js +0 -34
- package/dist/chunk-QATP6Q3G.js +0 -52
- package/dist/chunk-TRRI7TXE.js +0 -185
- package/dist/cli-BLEXQVAS.js +0 -820
- 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.
|
|
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`
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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
|