vitest-auto-spy 5.21.0 → 5.21.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.
- package/AGENTS.md +10 -5
- package/README.md +28 -28
- package/dist/angular-diagnostics.d.ts +1 -1
- package/dist/angular-diagnostics.js +2 -2
- package/dist/angular-doubles.d.ts +3 -1
- package/dist/angular.d.ts +1 -1
- package/dist/angular.js +1 -1
- package/dist/bun-angular.d.ts +1 -1
- package/dist/bun-angular.js +4 -4
- package/dist/bun.js +2 -2
- package/dist/{chunk-3EV45V6W.js → chunk-NEFATXWT.js} +1 -1
- package/dist/{chunk-ZZSFAQT4.js → chunk-OEE74SMY.js} +1 -1
- package/dist/{chunk-GWEQZHMN.js → chunk-S5ARWUD4.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/dom-stubs.js +1 -1
- package/dist/index.js +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.js +1 -1
- package/dist/react.js +1 -1
- package/dist/rstest.js +2 -2
- package/dist/setup.js +1 -1
- package/dist/svelte.js +1 -1
- package/dist/{track-signal-runs-C3V6OIGM.d.ts → track-signal-runs-BSVObkds.d.ts} +1 -1
- package/dist/vue.js +1 -1
- package/package.json +3 -1
- package/skills/vitest-auto-spy/SKILL.md +10 -9
package/AGENTS.md
CHANGED
|
@@ -62,9 +62,9 @@ Add-ons, orthogonal to the runner:
|
|
|
62
62
|
| Run diagnostics | `vitest-auto-spy/diagnostics` | `compareTestRuns`, `summarizeTestRun`, `formatTestRunComparison`, `diffByField`. **Moved off the root in 4.0.0** |
|
|
63
63
|
| Angular HTTP | `vitest-auto-spy/angular-http` | `provideHttpTesting`, `expectRequest` — `httpResource()` / `HttpClient` (§13). Optional `@angular/common` peer, this entry only |
|
|
64
64
|
| Angular router | `vitest-auto-spy/angular-router` | `provideActivatedRoute`, `injectActivatedRoute` — an `ActivatedRoute` whose streams and snapshot share one record; `provideRouterDouble`, `injectRouterDouble` — a `Router` whose URL, `routerState` and `events` agree (§13). Optional `@angular/router` peer, this entry only |
|
|
65
|
-
| Angular diagnostics | `vitest-auto-spy/angular/diagnostics` | `enableAngularDiagnostics` and the whole TestBed timing family (§13). Companion to `/angular` like `/angular-http` — no core re-export; **moved off `/angular` in
|
|
66
|
-
| Angular doubles | `vitest-auto-spy/angular/doubles` | The Material dialog trio and the `Window`/`Document` platform doubles (§13). Companion to `/angular`; registers the Vitest adapter, so its doubles spy out of the box; **moved off `/angular` in
|
|
67
|
-
| Angular matchers | `vitest-auto-spy/angular/matchers` | `registerDirectiveMatchers`, `registerResourceMatchers`, `registerSignalMatchers` (§13). Companion to `/angular` — no core re-export; **moved off `/angular` in
|
|
65
|
+
| Angular diagnostics | `vitest-auto-spy/angular/diagnostics` | `enableAngularDiagnostics` and the whole TestBed timing family (§13). Companion to `/angular` like `/angular-http` — no core re-export; **moved off `/angular` in 5.21.0** so importing spies stops evaluating it |
|
|
66
|
+
| Angular doubles | `vitest-auto-spy/angular/doubles` | The Material dialog trio and the `Window`/`Document` platform doubles (§13). Companion to `/angular`; registers the Vitest adapter, so its doubles spy out of the box; **moved off `/angular` in 5.21.0** |
|
|
67
|
+
| Angular matchers | `vitest-auto-spy/angular/matchers` | `registerDirectiveMatchers`, `registerResourceMatchers`, `registerSignalMatchers` (§13). Companion to `/angular` — no core re-export; **moved off `/angular` in 5.21.0** |
|
|
68
68
|
| 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+ |
|
|
69
69
|
| Setup helpers | `vitest-auto-spy/setup` | `setupAutoSpy()`, `setupFakeTimers()`, `blockNetwork()`, `stubResponse()`; the entry imports Vitest, so it is not for `bun test` |
|
|
70
70
|
| Zone patch | `import 'vitest-auto-spy/zone'` | `fakeAsync` / `waitForAsync` on Vitest (§14) |
|
|
@@ -2286,7 +2286,7 @@ zone.js alike. The entry needs **Angular >= 20** (§1); on 16 or 17 it does not
|
|
|
2286
2286
|
`ɵSIGNAL` is not there to import.
|
|
2287
2287
|
|
|
2288
2288
|
**Niche Angular helpers ship in narrow companion subpaths, never in `/angular`** — the pattern of
|
|
2289
|
-
`/angular-http`, `/angular-router` and `/signal-forms`, and since
|
|
2289
|
+
`/angular-http`, `/angular-router` and `/signal-forms`, and since 5.21.0 of `/angular/diagnostics`,
|
|
2290
2290
|
`/angular/doubles` and `/angular/matchers`. An import of `/angular` evaluates its whole graph, so a
|
|
2291
2291
|
helper a suite names once in a setup file must not ride along with every `provideAutoSpy` import;
|
|
2292
2292
|
the diagnostics, doubles and matcher registrars left on that rule (`trackInjections` stays —
|
|
@@ -4140,7 +4140,12 @@ the eaten glob below came from.
|
|
|
4140
4140
|
|
|
4141
4141
|
Two of its checks are about this package's own names. `helper-from-wrong-entry` catches a named
|
|
4142
4142
|
import taken from an entry that does not export it — `provideAutoSpy` from the root rather than
|
|
4143
|
-
`/angular` or `/nestjs`, `expectRequest` from anywhere but `/angular-http`.
|
|
4143
|
+
`/angular` or `/nestjs`, `expectRequest` from anywhere but `/angular-http`. It reads both directions
|
|
4144
|
+
of the 5.21.0 Angular split — one of the thirty-two moved names still taken from `/angular`, and a
|
|
4145
|
+
core name taken from `/angular/diagnostics`, `/angular/doubles` or `/angular/matchers`, which export
|
|
4146
|
+
none of them — which makes it what fails that upgrade rather than a compiler: a repository green on
|
|
4147
|
+
5.20.0 exits 1 here with no test run, and the fix line names the companion to move to.
|
|
4148
|
+
`no-unawaited-helper`
|
|
4144
4149
|
catches an `expectEmission` / `expectError` / `stable` / `flushEventLoop` called as a bare statement
|
|
4145
4150
|
and dropped, so the promise settles after the test ended and its assertion reports into a later test
|
|
4146
4151
|
or nowhere. Both resolve the name against a table **generated from this package's own `exports`
|
package/README.md
CHANGED
|
@@ -1442,34 +1442,34 @@ the conditional types that pick helpers from a return type — see
|
|
|
1442
1442
|
The library ships a framework-agnostic core plus runtime and framework layers, so a plain
|
|
1443
1443
|
Node / Bun / React / Vue project pulls **neither rxjs nor Angular into its runtime bundle**:
|
|
1444
1444
|
|
|
1445
|
-
| Import | Provides
|
|
1446
|
-
| ------------------------------------- |
|
|
1447
|
-
| `vitest-auto-spy` | `createSpyFromClass`, `createAutoMock`, `createFunctionSpy`, sync + promise + accessor spies, `errorHandler`, types
|
|
1448
|
-
| `vitest-auto-spy/rxjs` | observable spies (`nextWith`, `nextWithValues`, `observablePropsToSpyOn`, …) and `createObservableWithValues`
|
|
1449
|
-
| `vitest-auto-spy/angular` | `provideAutoSpy`, `injectSpy`, `renderShallow`, `setInputs`, `createWithAutoSpies`, `stable`/`flushEffects`, `settleResource`, `mockResourceProp`, the `mock*Prop` helpers, `trackRecomputations` / `trackEffectRuns` — the diagnostics, doubles and matchers below moved off this entry in
|
|
1450
|
-
| `vitest-auto-spy/angular/diagnostics` | `enableAngularDiagnostics` and the whole TestBed timing family — a companion to `/angular`, no core re-export; moved off `/angular` in
|
|
1451
|
-
| `vitest-auto-spy/angular/doubles` | the `window` / `document` and Material-dialog doubles; registers the Vitest adapter, so its doubles spy out of the box; moved off `/angular` in
|
|
1452
|
-
| `vitest-auto-spy/angular/matchers` | `registerDirectiveMatchers`, `registerResourceMatchers`, `registerSignalMatchers` — a companion to `/angular`, no core re-export; moved off `/angular` in
|
|
1453
|
-
| `vitest-auto-spy/angular-http` | `provideHttpTesting`, `expectRequest`, `expectNoRequest`, `verifyNoPendingRequests` — the `httpResource()` / `HttpClient` recipe in two lines, settling included
|
|
1454
|
-
| `vitest-auto-spy/angular-router` | `provideActivatedRoute`, `injectActivatedRoute`, `createActivatedRoute` — Angular's own `ActivatedRoute` over one record, streams and snapshot moved together; `provideRouterDouble` / `injectRouterDouble` for the `Router` beside it
|
|
1455
|
-
| `vitest-auto-spy/signal-forms` | `createForm` — Angular's own `form()` built where it can inject — and `registerFormMatchers()` for `toHaveFieldErrors`
|
|
1456
|
-
| `vitest-auto-spy/bun` | the same core, driven by Bun's `bun:test` mocks
|
|
1457
|
-
| `vitest-auto-spy/bun-angular` | Angular's `TestBed` under `bun test` — DOM, JIT `templateUrl` resolution and a zoneless environment, from one preload
|
|
1458
|
-
| `vitest-auto-spy/node` | the same core, driven by `node:test`'s `mock.fn()`, plus `trackNodeMocks()` — a private `MockTracker` so dropped spies are actually freed
|
|
1459
|
-
| `vitest-auto-spy/rstest` | the same core, driven by Rstest's `rstest.fn()` / `rstest.spyOn()`
|
|
1460
|
-
| `vitest-auto-spy/nestjs` | `provideAutoSpy`, `injectSpy` for `Test.createTestingModule`
|
|
1461
|
-
| `vitest-auto-spy/react` | the core, with a natural import for React Testing Library suites
|
|
1462
|
-
| `vitest-auto-spy/vue` | `provideAutoSpy` for `global.provide` + Pinia store spying
|
|
1463
|
-
| `vitest-auto-spy/svelte` | the core, with a natural import for Svelte suites
|
|
1464
|
-
| `vitest-auto-spy/console` | `consoleInfoSpy` & friends — silent typed spies over the global `console`, installed on import
|
|
1465
|
-
| `vitest-auto-spy/jasmine` | the drop-in surface for a `jasmine-auto-spies` suite — `.and` / `.calls` / `.withArgs` on every spy, `createSpyObj`, the `jasmine` namespace, `registerJasmineMatchers`
|
|
1466
|
-
| `vitest-auto-spy/jasmine-compat` | `enableJasmineCompat()` alone — the same `.and` / `.calls` layer, registering no adapter, for `bun test` and `node --test`
|
|
1467
|
-
| `vitest-auto-spy/observer-spy` | `subscribeSpyTo` / `ObserverSpy` / `SubscriberSpy` — the `@hirez_io/observer-spy` surface, so `/rxjs` does not carry it
|
|
1468
|
-
| `vitest-auto-spy/dom-stubs` | the globals a component builds for itself — `stubIntersectionObserver`, `stubResizeObserver`, `stubMutationObserver`, `stubObserver`, `stubMediaElement`, `stubAbortController`, the entry builders, and `stubWebStorage` with its `snapshot()`. On the root entry until 4.0.0
|
|
1469
|
-
| `vitest-auto-spy/diagnostics` | `compareTestRuns` / `summarizeTestRun` / `formatTestRunComparison`, `diffByField` and `explainSpy` — the two reports a counter cannot give; pure functions, so a plain Node script can import this one too. On the root entry until 4.0.0
|
|
1470
|
-
| `vitest-auto-spy/setup` | `setupAutoSpy()` — property restore, duplicate-copy detection and mock-registry hygiene in one call; `setupFakeTimers()` / `advanceTimers()`
|
|
1471
|
-
| `vitest-auto-spy/zone` | `fakeAsync` / `waitForAsync` on Vitest — the ProxyZone patch `zone.js/testing` does not ship. Reads the `zone.js` **you** loaded; imports none of it
|
|
1472
|
-
| `vitest-auto-spy/eslint-plugin` | the lint rules that steer a suite onto these helpers
|
|
1445
|
+
| Import | Provides | Pulls in | Status |
|
|
1446
|
+
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | :----: |
|
|
1447
|
+
| `vitest-auto-spy` | `createSpyFromClass`, `createAutoMock`, `createFunctionSpy`, sync + promise + accessor spies, `errorHandler`, types | `vitest` | ✅ |
|
|
1448
|
+
| `vitest-auto-spy/rxjs` | observable spies (`nextWith`, `nextWithValues`, `observablePropsToSpyOn`, …) and `createObservableWithValues` | `rxjs` | ✅ |
|
|
1449
|
+
| `vitest-auto-spy/angular` | `provideAutoSpy`, `injectSpy`, `renderShallow`, `setInputs`, `createWithAutoSpies`, `stable`/`flushEffects`, `settleResource`, `mockResourceProp`, the `mock*Prop` helpers, `trackRecomputations` / `trackEffectRuns` — the diagnostics, doubles and matchers below moved off this entry in 5.21.0 | `@angular/core` | ✅ |
|
|
1450
|
+
| `vitest-auto-spy/angular/diagnostics` | `enableAngularDiagnostics` and the whole TestBed timing family — a companion to `/angular`, no core re-export; moved off `/angular` in 5.21.0 | `@angular/core` | ✅ |
|
|
1451
|
+
| `vitest-auto-spy/angular/doubles` | the `window` / `document` and Material-dialog doubles; registers the Vitest adapter, so its doubles spy out of the box; moved off `/angular` in 5.21.0 | `@angular/core` | ✅ |
|
|
1452
|
+
| `vitest-auto-spy/angular/matchers` | `registerDirectiveMatchers`, `registerResourceMatchers`, `registerSignalMatchers` — a companion to `/angular`, no core re-export; moved off `/angular` in 5.21.0 | `@angular/core`, `@angular/platform-browser` | ✅ |
|
|
1453
|
+
| `vitest-auto-spy/angular-http` | `provideHttpTesting`, `expectRequest`, `expectNoRequest`, `verifyNoPendingRequests` — the `httpResource()` / `HttpClient` recipe in two lines, settling included | `@angular/common` | ✅ |
|
|
1454
|
+
| `vitest-auto-spy/angular-router` | `provideActivatedRoute`, `injectActivatedRoute`, `createActivatedRoute` — Angular's own `ActivatedRoute` over one record, streams and snapshot moved together; `provideRouterDouble` / `injectRouterDouble` for the `Router` beside it | `@angular/router` | ✅ |
|
|
1455
|
+
| `vitest-auto-spy/signal-forms` | `createForm` — Angular's own `form()` built where it can inject — and `registerFormMatchers()` for `toHaveFieldErrors` | `@angular/forms` (>=22) | ✅ |
|
|
1456
|
+
| `vitest-auto-spy/bun` | the same core, driven by Bun's `bun:test` mocks | `bun:test` | ✅ |
|
|
1457
|
+
| `vitest-auto-spy/bun-angular` | Angular's `TestBed` under `bun test` — DOM, JIT `templateUrl` resolution and a zoneless environment, from one preload | `bun:test`, `@angular/core`, `@angular/platform-browser` | ✅ |
|
|
1458
|
+
| `vitest-auto-spy/node` | the same core, driven by `node:test`'s `mock.fn()`, plus `trackNodeMocks()` — a private `MockTracker` so dropped spies are actually freed | `node:test` | ✅ |
|
|
1459
|
+
| `vitest-auto-spy/rstest` | the same core, driven by Rstest's `rstest.fn()` / `rstest.spyOn()` | `@rstest/core` | ✅ |
|
|
1460
|
+
| `vitest-auto-spy/nestjs` | `provideAutoSpy`, `injectSpy` for `Test.createTestingModule` | — (your `@nestjs/*`) | ✅ |
|
|
1461
|
+
| `vitest-auto-spy/react` | the core, with a natural import for React Testing Library suites | — (your `react`) | ✅ |
|
|
1462
|
+
| `vitest-auto-spy/vue` | `provideAutoSpy` for `global.provide` + Pinia store spying | — (your `vue`/`pinia`) | ✅ |
|
|
1463
|
+
| `vitest-auto-spy/svelte` | the core, with a natural import for Svelte suites | — (your `svelte`) | ✅ |
|
|
1464
|
+
| `vitest-auto-spy/console` | `consoleInfoSpy` & friends — silent typed spies over the global `console`, installed on import | `vitest` | ✅ |
|
|
1465
|
+
| `vitest-auto-spy/jasmine` | the drop-in surface for a `jasmine-auto-spies` suite — `.and` / `.calls` / `.withArgs` on every spy, `createSpyObj`, the `jasmine` namespace, `registerJasmineMatchers` | `vitest` | ✅ |
|
|
1466
|
+
| `vitest-auto-spy/jasmine-compat` | `enableJasmineCompat()` alone — the same `.and` / `.calls` layer, registering no adapter, for `bun test` and `node --test` | — (your runner) | ✅ |
|
|
1467
|
+
| `vitest-auto-spy/observer-spy` | `subscribeSpyTo` / `ObserverSpy` / `SubscriberSpy` — the `@hirez_io/observer-spy` surface, so `/rxjs` does not carry it | `rxjs` | ✅ |
|
|
1468
|
+
| `vitest-auto-spy/dom-stubs` | the globals a component builds for itself — `stubIntersectionObserver`, `stubResizeObserver`, `stubMutationObserver`, `stubObserver`, `stubMediaElement`, `stubAbortController`, the entry builders, and `stubWebStorage` with its `snapshot()`. On the root entry until 4.0.0 | — | ✅ |
|
|
1469
|
+
| `vitest-auto-spy/diagnostics` | `compareTestRuns` / `summarizeTestRun` / `formatTestRunComparison`, `diffByField` and `explainSpy` — the two reports a counter cannot give; pure functions, so a plain Node script can import this one too. On the root entry until 4.0.0 | — | ✅ |
|
|
1470
|
+
| `vitest-auto-spy/setup` | `setupAutoSpy()` — property restore, duplicate-copy detection and mock-registry hygiene in one call; `setupFakeTimers()` / `advanceTimers()` | `vitest` | ✅ |
|
|
1471
|
+
| `vitest-auto-spy/zone` | `fakeAsync` / `waitForAsync` on Vitest — the ProxyZone patch `zone.js/testing` does not ship. Reads the `zone.js` **you** loaded; imports none of it | — (your `zone.js`) | ✅ |
|
|
1472
|
+
| `vitest-auto-spy/eslint-plugin` | the lint rules that steer a suite onto these helpers | — (your `eslint`) | ✅ |
|
|
1473
1473
|
|
|
1474
1474
|
✅ all entry points published (see [Availability](#availability)).
|
|
1475
1475
|
|
|
@@ -156,7 +156,7 @@ declare function reportSpecTiming(timing: SpecTiming): void;
|
|
|
156
156
|
*
|
|
157
157
|
* ```ts
|
|
158
158
|
* // vitest.setup.ts
|
|
159
|
-
* import { enableTestBedDiagnostics } from 'vitest-auto-spy/angular';
|
|
159
|
+
* import { enableTestBedDiagnostics } from 'vitest-auto-spy/angular/diagnostics';
|
|
160
160
|
*
|
|
161
161
|
* if (process.env['SPEC_TIMING']) {
|
|
162
162
|
* enableTestBedDiagnostics();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { instrumentTestBed, onTestingModuleConfigured, onComponentCreated, beforeTestBedReset, verifyOnTeardown } from './chunk-KOR5OK4H.js';
|
|
2
2
|
export { disableTestBedDiagnostics, enableTestBedDiagnostics, formatSpecTiming, getTestBedTiming, instrumentTestBed, reportSpecTiming } from './chunk-KOR5OK4H.js';
|
|
3
|
-
import { failOnUnspiedProvider } from './chunk-
|
|
3
|
+
import { failOnUnspiedProvider } from './chunk-NEFATXWT.js';
|
|
4
4
|
import { assertAngularInternals } from './chunk-NS3Y6AQB.js';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-S5ARWUD4.js';
|
|
6
6
|
import './chunk-I6JZIWIZ.js';
|
|
7
7
|
import './chunk-SA2QIER3.js';
|
|
8
8
|
import './chunk-PC3FAZT3.js';
|
|
@@ -19,7 +19,9 @@ import 'vitest';
|
|
|
19
19
|
* is still typed against the token the spec passed and the result against the `close()` of the class
|
|
20
20
|
* it passed.
|
|
21
21
|
*
|
|
22
|
-
* rxjs is imported here and nowhere else
|
|
22
|
+
* rxjs is imported here and, bar `/angular-router`, nowhere else in the Angular entry family — and
|
|
23
|
+
* since the split moved this module to `vitest-auto-spy/angular/doubles` it no longer reaches
|
|
24
|
+
* `vitest-auto-spy/angular` at all. Deliberately, in either place: a component
|
|
23
25
|
* pipes `afterClosed()`, so the stream has to be a real `Observable` rather than something
|
|
24
26
|
* subscribable. `@angular/core` has rxjs as a peer dependency of its own, so a suite that can import
|
|
25
27
|
* this entry already has it.
|
package/dist/angular.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { o as AngularTokenProvider, A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, R as RenderShallowOptions, c as ResourceStatusLike, d as RunCounter, S as SettleResourceOptions, e as ShallowRender, f as SpyRegistry, g as StableOptions, h as createWithAutoSpies, i as flushEffects, j as injectSpy, p as provideAutoSpy, q as provideAutoSpyForToken, r as renderShallow, k as runEffect, s as setInputs, l as settleResource, m as stable, t as trackEffectRuns, n as trackRecomputations } from './track-signal-runs-
|
|
1
|
+
export { o as AngularTokenProvider, A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, R as RenderShallowOptions, c as ResourceStatusLike, d as RunCounter, S as SettleResourceOptions, e as ShallowRender, f as SpyRegistry, g as StableOptions, h as createWithAutoSpies, i as flushEffects, j as injectSpy, p as provideAutoSpy, q as provideAutoSpyForToken, r as renderShallow, k as runEffect, s as setInputs, l as settleResource, m as stable, t as trackEffectRuns, n as trackRecomputations } from './track-signal-runs-BSVObkds.js';
|
|
2
2
|
import { InjectionToken, Provider, Type, WritableSignal, Signal } from '@angular/core';
|
|
3
3
|
import { A as AutoMockConfiguration, D as DeepReadonly } from './expect-emission-S5asJaJP.js';
|
|
4
4
|
export { C as CallbackSubscribable, E as EmissionObserver, b as EmissionOptions, c as EmissionSource, S as SubscribableLike, g as expectCompletion, h as expectEmission, i as expectEmissions, j as expectError, k as expectNoEmission, s as setEmissionTimeout } from './expect-emission-S5asJaJP.js';
|
package/dist/angular.js
CHANGED
package/dist/bun-angular.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { AdoptMockOptions, AdoptedMock, ArgCaptor, AsInstances, AssertMockedOpti
|
|
|
3
3
|
export { A as AutoMockConfiguration, a as AutoSpyDefaultEntry, C as CallbackSubscribable, E as EmissionObserver, b as EmissionOptions, c as EmissionSource, S as SubscribableLike, d as autoMocked, e as clearAutoSpyDefaults, f as createAutoMock, g as expectCompletion, h as expectEmission, i as expectEmissions, j as expectError, k as expectNoEmission, r as registerAutoSpyDefaults, s as setEmissionTimeout } from './expect-emission-S5asJaJP.js';
|
|
4
4
|
export { c as createFunctionSpy, d as describeDuplicateCopies, g as getPackageCopies } from './package-identity-Cn7yncmJ.js';
|
|
5
5
|
export { A as AccessorImplementations, O as OutsideHookReaction, R as RestoreProp, c as countMockedProps, m as mockAccessorsProp, a as mockReadonlyProp, b as mockReadonlyPropGetter, d as mockValueProp, r as reportPropsOutsideHooks, e as restoreMockedProps } from './prop-mock-C--a8rpU.js';
|
|
6
|
-
export { A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, R as RenderShallowOptions, c as ResourceStatusLike, d as RunCounter, S as SettleResourceOptions, e as ShallowRender, f as SpyRegistry, g as StableOptions, h as createWithAutoSpies, i as flushEffects, j as injectSpy, p as provideAutoSpy, r as renderShallow, k as runEffect, s as setInputs, l as settleResource, m as stable, t as trackEffectRuns, n as trackRecomputations } from './track-signal-runs-
|
|
6
|
+
export { A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, R as RenderShallowOptions, c as ResourceStatusLike, d as RunCounter, S as SettleResourceOptions, e as ShallowRender, f as SpyRegistry, g as StableOptions, h as createWithAutoSpies, i as flushEffects, j as injectSpy, p as provideAutoSpy, r as renderShallow, k as runEffect, s as setInputs, l as settleResource, m as stable, t as trackEffectRuns, n as trackRecomputations } from './track-signal-runs-BSVObkds.js';
|
|
7
7
|
import 'vitest';
|
|
8
8
|
import '@angular/core';
|
|
9
9
|
import '@angular/core/testing';
|
package/dist/bun-angular.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createSpyForToken } from './chunk-TQAYWU5J.js';
|
|
2
|
-
export { injectSpy, provideAutoSpy } from './chunk-
|
|
2
|
+
export { injectSpy, provideAutoSpy } from './chunk-NEFATXWT.js';
|
|
3
3
|
import { stable, flushEffects } from './chunk-RPCKHTDN.js';
|
|
4
4
|
export { flushEffects, stable } from './chunk-RPCKHTDN.js';
|
|
5
5
|
import { angularInternalsError } from './chunk-NS3Y6AQB.js';
|
|
6
6
|
import './chunk-QT5JIDOK.js';
|
|
7
|
-
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-
|
|
8
|
-
import { mockValueProp } from './chunk-
|
|
9
|
-
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-
|
|
7
|
+
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-OEE74SMY.js';
|
|
8
|
+
import { mockValueProp } from './chunk-S5ARWUD4.js';
|
|
9
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-S5ARWUD4.js';
|
|
10
10
|
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-I6JZIWIZ.js';
|
|
11
11
|
import './chunk-SOROJD3W.js';
|
|
12
12
|
import './chunk-ITOFGQTX.js';
|
package/dist/bun.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './chunk-QT5JIDOK.js';
|
|
2
|
-
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-
|
|
3
|
-
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-
|
|
2
|
+
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-OEE74SMY.js';
|
|
3
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-S5ARWUD4.js';
|
|
4
4
|
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-I6JZIWIZ.js';
|
|
5
5
|
import './chunk-SOROJD3W.js';
|
|
6
6
|
import './chunk-ITOFGQTX.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { currentSpecFile } from './chunk-
|
|
1
|
+
import { currentSpecFile } from './chunk-S5ARWUD4.js';
|
|
2
2
|
import { createSpyFromClass } from './chunk-I6JZIWIZ.js';
|
|
3
3
|
import { misconfigurationThrows, reportMisconfiguration } from './chunk-4SJY7ZHM.js';
|
|
4
4
|
import { isAutoSpyLike } from './chunk-R3DF5ZEO.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mockValueProp, mockAccessorsProp } from './chunk-
|
|
1
|
+
import { mockValueProp, mockAccessorsProp } from './chunk-S5ARWUD4.js';
|
|
2
2
|
import { resolveConfiguration, mergeAutoSpyDefaults, resolveReadGuard, mergeMethodNames, getCallableMemberNames, createTrackedPropSpy, applyConfiguredReturns, createSpyFromClass, warnOnUnknownMethods, warnOnAccessorNamingAMethod, resolveAccessors, createAccessorsSpies, createProxyPropStore, storeWriteTraps, describeStoredProp, hasStoredProp, isProtocolKey, isDeletedProp, readStoredAccessor, NOT_STORED, disposeAutoSpy, writeStoredValue } from './chunk-I6JZIWIZ.js';
|
|
3
3
|
import { unpatchedSetTimeout, unpatchedClearTimeout } from './chunk-SOROJD3W.js';
|
|
4
4
|
import { redefineFailure } from './chunk-SA2QIER3.js';
|
package/dist/cli.js
CHANGED
|
@@ -2793,7 +2793,7 @@ function checkForeignPragma(graph) {
|
|
|
2793
2793
|
}
|
|
2794
2794
|
|
|
2795
2795
|
// src/cli/checks/export-map.generated.ts
|
|
2796
|
-
var EXPORT_MAP_VERSION = "5.
|
|
2796
|
+
var EXPORT_MAP_VERSION = "5.21.0";
|
|
2797
2797
|
var ENTRY_SPECIFIERS = "vitest-auto-spy vitest-auto-spy/bun vitest-auto-spy/bun-angular vitest-auto-spy/node vitest-auto-spy/rstest vitest-auto-spy/rxjs vitest-auto-spy/console vitest-auto-spy/dom-stubs vitest-auto-spy/diagnostics vitest-auto-spy/jasmine vitest-auto-spy/jasmine-compat vitest-auto-spy/observer-spy vitest-auto-spy/angular vitest-auto-spy/angular/diagnostics vitest-auto-spy/angular/doubles vitest-auto-spy/angular/matchers vitest-auto-spy/angular-http vitest-auto-spy/angular-router vitest-auto-spy/signal-forms vitest-auto-spy/nestjs vitest-auto-spy/react vitest-auto-spy/vue vitest-auto-spy/svelte vitest-auto-spy/setup vitest-auto-spy/zone vitest-auto-spy/eslint-plugin";
|
|
2798
2798
|
var EXPORTED_BY = {
|
|
2799
2799
|
AccessorImplementations: "0 1 2 3 4 12 20 21 22",
|
|
@@ -3292,7 +3292,7 @@ var OWNERS = new Map(
|
|
|
3292
3292
|
var NAMES_BY_ENTRY = new Map(
|
|
3293
3293
|
ENTRIES.map((entry) => [entry, new Set([...OWNERS].filter(([, owners]) => owners.includes(entry)).map(([name]) => name))])
|
|
3294
3294
|
);
|
|
3295
|
-
var IMPORT = /\bimport\s+(?:type\s+)?([\s\w$*,{}]*?)\s*from\s*["'](vitest-auto-spy(?:\/[\w-]+)
|
|
3295
|
+
var IMPORT = /\bimport\s+(?:type\s+)?([\s\w$*,{}]*?)\s*from\s*["'](vitest-auto-spy(?:\/[\w-]+){0,2})["']/g;
|
|
3296
3296
|
var BRACED = /{([^}]*)}/g;
|
|
3297
3297
|
var RENAME = " as ";
|
|
3298
3298
|
function parseClause(clause, entry) {
|
package/dist/dom-stubs.js
CHANGED
package/dist/index.js
CHANGED
package/dist/node.cjs
CHANGED
package/dist/node.js
CHANGED
package/dist/react.js
CHANGED
package/dist/rstest.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-
|
|
2
|
-
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-
|
|
1
|
+
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-OEE74SMY.js';
|
|
2
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-S5ARWUD4.js';
|
|
3
3
|
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-I6JZIWIZ.js';
|
|
4
4
|
import './chunk-SOROJD3W.js';
|
|
5
5
|
import { clearAllFastSpies, resetAllFastSpies, getSpyEngine, createFastSpy } from './chunk-2KBFEQOV.js';
|
package/dist/setup.js
CHANGED
package/dist/svelte.js
CHANGED
|
@@ -127,7 +127,7 @@ declare function provideAutoSpyForToken<T>(token: InjectionToken<T>, overrides?:
|
|
|
127
127
|
* When the injector hands back a real instance rather than a double, that is reported — a provider
|
|
128
128
|
* the spec forgot to register is otherwise found much later, when `.mockReturnValue` is called on
|
|
129
129
|
* the real method. It is a `console.warn`, once per token and spec file; raise it to a thrown failure
|
|
130
|
-
* with `enableAngularDiagnostics({ unspiedProviders: true })` from `vitest-auto-spy/angular`, or for
|
|
130
|
+
* with `enableAngularDiagnostics({ unspiedProviders: true })` from `vitest-auto-spy/angular/diagnostics`, or for
|
|
131
131
|
* every misconfiguration report at once with `setupAutoSpy({ misconfiguration: 'throw' })`.
|
|
132
132
|
*/
|
|
133
133
|
/**
|
package/dist/vue.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-auto-spy",
|
|
3
|
-
"version": "5.21.
|
|
3
|
+
"version": "5.21.1",
|
|
4
4
|
"description": "Auto-generate fully-typed test spies from a class — across Vitest, Bun, node:test and Rstest, with Angular/NestJS/React/Vue/Svelte recipes. Drop-in replacement for jest-auto-spies and jasmine-auto-spies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auto-mock",
|
|
@@ -232,6 +232,8 @@
|
|
|
232
232
|
"**/rstest.js",
|
|
233
233
|
"src/rstest.ts",
|
|
234
234
|
"**/angular.js",
|
|
235
|
+
"**/angular-doubles.js",
|
|
236
|
+
"**/angular-matchers.js",
|
|
235
237
|
"**/angular-http.js",
|
|
236
238
|
"**/nestjs.js",
|
|
237
239
|
"**/react.js",
|
|
@@ -174,7 +174,7 @@ it('loads', async () => {
|
|
|
174
174
|
| a guard or a class built with `new` that takes the route | `createActivatedRoute({ params })` — the same handle, no `TestBed` |
|
|
175
175
|
| a node:test suite whose heap grows all run | `trackNodeMocks()` — `/node`, a private MockTracker |
|
|
176
176
|
| a Nest provider whose constructor keeps changing | `createNestUnit(Target, { expose })` — built from its DI metadata |
|
|
177
|
-
| asserting a resource's value _and_ status together | `registerResourceMatchers()` → `toHaveResourceValue` / `toBeLoading`
|
|
177
|
+
| asserting a resource's value _and_ status together | `registerResourceMatchers()` (`/angular/matchers`) → `toHaveResourceValue` / `toBeLoading` |
|
|
178
178
|
| a callback or config object the code under test built | `captureArg<T>()` in the assertion, then read `.value`; `{ where }` records only what it accepts |
|
|
179
179
|
| an object the test already holds — a real service, a client, `TestBed.inject(X)` | `createSpyFromInstance(obj, config?)` — patches it in place, `restoreSpiedInstance` undoes it |
|
|
180
180
|
| assert calls on a real object or service but keep it working | `createSpyFromInstance(obj, { passthrough: true })` — real method runs until configured; not with `strict: true` on the same call |
|
|
@@ -218,8 +218,8 @@ it('loads', async () => {
|
|
|
218
218
|
| a strict throw caught by a `try`/`catch` or an operator, the test still green | `setupAutoSpy({ swallowedStrictCalls: 'throw' })`; provoked on purpose — `takeStrictViolations()` from `/setup` |
|
|
219
219
|
| a strict double's getter answering `undefined`, or its `items$` never emitting | `setupAutoSpy({ unconfiguredReads: 'throw' })` reports it after the test; survey first with `onUnstubbedRead` |
|
|
220
220
|
| an `afterEach` that exists only to reset one spy | `using spy = createSpyFromClass(X)` — `[Symbol.dispose]` runs `resetAutoSpy`, which is `vi.resetAllMocks()` for one double |
|
|
221
|
-
| a dead NgModule import, dead `schemas`, an unflushed HTTP request | `enableAngularDiagnostics()` in the setup file, after `initTestEnvironment`
|
|
222
|
-
| the spy is provided but the component resolves its own, so the test runs the real service | `enableAngularDiagnostics({ shadowedProviders })
|
|
221
|
+
| a dead NgModule import, dead `schemas`, an unflushed HTTP request | `enableAngularDiagnostics()` (`/angular/diagnostics`) in the setup file, after `initTestEnvironment` |
|
|
222
|
+
| the spy is provided but the component resolves its own, so the test runs the real service | `enableAngularDiagnostics({ shadowedProviders })` or `assertNoShadowedProviders(Component, fixture)` — `/angular/diagnostics` |
|
|
223
223
|
| "which collaborators did this actually inject?" | `trackInjections([A, TOKEN])` — providers plus the record, not `vi.mock` |
|
|
224
224
|
| `NG0303` / `NG0301` / `NG0304` from an imported NgModule | `assertNgModuleScopes(Module)` — an AOT bundle stripped its scope |
|
|
225
225
|
| `Cannot read properties of undefined (reading 'provide')` in `di_setup` | `assertComponentDefIntact(Cmp)` — a barrel chunk left a hole in `ɵcmp` |
|
|
@@ -238,7 +238,7 @@ it('loads', async () => {
|
|
|
238
238
|
| the same document check without `setupAutoSpy()` | `guardDocumentPollution('throw')` from `/setup` |
|
|
239
239
|
| `A metric with the name … has already been registered` / `customElements.define` twice, at import | a module scope evaluated once per spec file under the Angular builder — guard the registration (`getSingleMetric`, `customElements.get`) |
|
|
240
240
|
| console output a test never asserted on (a `'warn'` from this library does not count) | `setupAutoSpy({ strayConsole: 'throw' })` fails that test; absorb with `installConsoleSpies()` in `beforeEach` |
|
|
241
|
-
| every guard at its strictest grade in one line | `setupAutoSpy({ preset: 'strict' })` — plus `enableAngularDiagnostics()` for Angular
|
|
241
|
+
| every guard at its strictest grade in one line | `setupAutoSpy({ preset: 'strict' })` — plus `enableAngularDiagnostics()` from `/angular/diagnostics` for Angular |
|
|
242
242
|
| an `onlyMethodsToSpyOn` typo or `injectSpy` on a real instance that only warned | `setupAutoSpy({ misconfiguration: 'throw' })` throws at the call |
|
|
243
243
|
| which file and call scheduled a timer that outlived its file | `onStrayTimers: ({ timers }) => expect(timers).toEqual([])`, or `describeStrayTimers()` from `/setup` |
|
|
244
244
|
| stray timers charged to a file that only writes `localStorage` (jsdom) | `withoutStrayTimerTracking(() => seed())` from `/setup` — its timers are neither counted nor cancelled |
|
|
@@ -266,11 +266,11 @@ it('loads', async () => {
|
|
|
266
266
|
| an input that has to change after the first render | `await setInputs(fixture, { … })` — aliases and `hostDirectives` inputs resolve, unknown names refused |
|
|
267
267
|
| a component that navigates, or reads `router.url` | `provideRouterDouble({ url })` + `injectRouterDouble()` — `/angular-router` |
|
|
268
268
|
| a component that reads `router.currentNavigation()` for `extras.state` or `trigger` | `setCurrentNavigation({ extras: { state } })` on the same handle — no `instanceMethodsToSpyOn` |
|
|
269
|
-
| a `window` or `document` behind a DI token | `provideWindowDouble(WINDOW, { screen })` / `provideDocumentDouble({ … })`
|
|
270
|
-
| `MAT_DIALOG_DATA` and `MatDialogRef` provided by hand | `provideMatDialogData(TOKEN, data)` / `provideMatDialogRef(MatDialogRef)` + `injectMatDialogRef(Ref)`
|
|
269
|
+
| a `window` or `document` behind a DI token | `provideWindowDouble(WINDOW, { screen })` / `provideDocumentDouble({ … })` — `/angular/doubles` |
|
|
270
|
+
| `MAT_DIALOG_DATA` and `MatDialogRef` provided by hand | `provideMatDialogData(TOKEN, data)` / `provideMatDialogRef(MatDialogRef)` + `injectMatDialogRef(Ref)` — `/angular/doubles` |
|
|
271
271
|
| asserting a `computed()` did **not** recompute | `trackRecomputations(sig)` / `trackEffectRuns(ref)` — `{ count, stop() }` |
|
|
272
272
|
| `form()` in a spec, or `errors()` read by hand | `createForm(model, schema)` + `registerFormMatchers()` — then `toHaveFieldErrors([…])` (`/signal-forms`) |
|
|
273
|
-
| any of those doubles without a `TestBed` | `createRouterDouble` / `createWindowDouble` / `createDocumentDouble` / `createMatDialogRef`
|
|
273
|
+
| any of those doubles without a `TestBed` | `createRouterDouble` (`/angular-router`) / `createWindowDouble` / `createDocumentDouble` / `createMatDialogRef` (`/angular/doubles`) |
|
|
274
274
|
|
|
275
275
|
## Rules that prevent most of the mistakes
|
|
276
276
|
|
|
@@ -328,10 +328,11 @@ it('loads', async () => {
|
|
|
328
328
|
it took to stderr, with where the first three were scheduled; `onStrayTimers` receives every one's
|
|
329
329
|
file and frames in `timers` instead of the warning.
|
|
330
330
|
- **Never assert a signal with `toBeTruthy()`** — every signal is truthy. Use
|
|
331
|
-
`toHaveSignalValue(v)` after `registerSignalMatchers()`.
|
|
331
|
+
`toHaveSignalValue(v)` after `registerSignalMatchers()` from `vitest-auto-spy/angular/matchers`.
|
|
332
332
|
- **Never assert a resource with `expect(r.value()).toEqual(...)` alone** — an unresolved resource
|
|
333
333
|
still holds its _default_, so that passes while proving nothing. `toHaveResourceValue(v)` after
|
|
334
|
-
`registerResourceMatchers()` fails unless the resource
|
|
334
|
+
`registerResourceMatchers()`, from the same `/angular/matchers` entry, fails unless the resource
|
|
335
|
+
actually resolved.
|
|
335
336
|
- **`calledWith` matches exact arguments first, then the matcher configs in registration order** —
|
|
336
337
|
so put the narrow `expect.any(Number)` before the wide `expect.anything()` when both can match.
|
|
337
338
|
Re-registering the same arguments replaces the previous answer, matcher arguments included: two
|