vitest-auto-spy 5.32.0 → 5.32.2
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 +8 -2
- package/CHANGELOG.md +63 -1
- package/README.md +8 -2
- package/dist/angular-diagnostics.js +10 -10
- package/dist/angular-doubles.js +8 -8
- package/dist/angular-http.js +4 -4
- package/dist/angular-matchers.js +1 -1
- package/dist/angular-router.js +5 -5
- package/dist/angular.d.ts +1 -1
- package/dist/angular.js +30 -14
- package/dist/bun-angular.d.ts +1 -1
- package/dist/bun-angular.js +34 -19
- package/dist/bun.js +9 -9
- package/dist/{chunk-SDTXE5SW.js → chunk-24JTFFQL.js} +1 -1
- package/dist/{chunk-LWSUV6IX.js → chunk-2QEM4WP7.js} +1 -1
- package/dist/{chunk-ANQVIGAG.js → chunk-6JLBZHQ3.js} +2 -2
- package/dist/{chunk-KCMPDMLY.js → chunk-6JQ7AFWM.js} +3 -3
- package/dist/{chunk-K3EUF6RK.js → chunk-72H6HNDI.js} +2 -2
- package/dist/{chunk-4IRFL76M.js → chunk-7WM3A4IB.js} +2 -2
- package/dist/{chunk-EDEGKIIR.js → chunk-CLQUJX6E.js} +1 -1
- package/dist/{chunk-G5KZLT7Q.js → chunk-DNXCZOYY.js} +1 -1
- package/dist/{chunk-4H6KZWGX.js → chunk-F2KBJC7P.js} +1 -1
- package/dist/{chunk-SQFEEO4W.js → chunk-GSMWYZ5A.js} +4 -4
- package/dist/{chunk-3Q76UTT6.js → chunk-JOPCMFYN.js} +2 -1
- package/dist/{chunk-TH64BXPP.js → chunk-JR55747M.js} +3 -3
- package/dist/{chunk-E46PPK33.js → chunk-LAPHUX5G.js} +1 -1
- package/dist/{chunk-NTCEH2FY.js → chunk-TMFV4DXT.js} +6 -6
- package/dist/{chunk-D2R6EQJJ.js → chunk-XNXIHKVM.js} +1 -1
- package/dist/{chunk-FRD6NXVY.js → chunk-XUPBHHJD.js} +1 -1
- package/dist/{chunk-25OHJOAA.js → chunk-YDPOBKST.js} +3 -3
- package/dist/{chunk-X74IM4MQ.js → chunk-YUGSITWJ.js} +1 -1
- package/dist/cli.js +21 -7
- package/dist/console.js +7 -7
- package/dist/eslint-plugin.cjs +15 -7
- package/dist/jasmine-compat.js +2 -2
- package/dist/jasmine.js +10 -10
- package/dist/nestjs.js +10 -10
- package/dist/rstest.js +9 -9
- package/dist/rxjs.js +2 -2
- package/dist/signal-forms.js +1 -1
- package/dist/{track-signal-runs-pFMHNAPy.d.ts → track-signal-runs-BVbIBVS7.d.ts} +1 -14
- package/dist/zone.js +1 -1
- package/package.json +1 -1
- package/skills/vitest-auto-spy/SKILL.md +6 -1
package/AGENTS.md
CHANGED
|
@@ -16,7 +16,9 @@ Setting this up for a team? `npx vitest-auto-spy init` writes a pointer to this
|
|
|
16
16
|
instruction files this repository's agents actually read — `AGENTS.md` (Codex, Cursor, Copilot and
|
|
17
17
|
most of the field), `CLAUDE.md` (Claude Code) and `GEMINI.md` (Gemini CLI), plus the glob-scoped
|
|
18
18
|
rule file of any tool whose own directory already exists. `--check` is the CI form; `--only
|
|
19
|
-
CLAUDE.md,.claude` limits it to the files a repository keeps untracked.
|
|
19
|
+
CLAUDE.md,.claude` limits it to the files a repository keeps untracked. A hand-made copy of the
|
|
20
|
+
package's skill in `.claude/skills/vitest-auto-spy/` is reported `stale` (and fails `--check`): delete
|
|
21
|
+
it and re-run `init`. Full table:
|
|
20
22
|
<https://asdalexey.github.io/vitest-auto-spy/agents>.
|
|
21
23
|
|
|
22
24
|
| Resource | Where |
|
|
@@ -3499,6 +3501,10 @@ const host = hostElement(fixture); // HTMLElement, checked with instanceof
|
|
|
3499
3501
|
queryElement(fixture, '.close').click(); // HTMLElement; throws naming the selector when nothing matches
|
|
3500
3502
|
queryElement(fixture.debugElement, 'input[name=q]', HTMLInputElement).value; // typed; wrong type throws
|
|
3501
3503
|
// also on /bun-angular; queryElement takes an element found earlier as its root too
|
|
3504
|
+
// a null source (debugElement.query() that matched nothing) throws saying so, not 'Cannot read properties of null'
|
|
3505
|
+
expect(queryElement(fixture, '.title').textContent.trim()).toBe('Orders'); // present: read through queryElement
|
|
3506
|
+
expect(host.querySelector('.empty-state')).toBeNull(); // absent: querySelector on the typed host, no cast
|
|
3507
|
+
// NOT host.querySelector('.title')?.textContent.trim() — a miss is undefined, which toBeFalsy() accepts
|
|
3502
3508
|
|
|
3503
3509
|
// build a class through DI, every unprovided token auto-spied
|
|
3504
3510
|
const { instance, spies } = createWithAutoSpies(CartService, {
|
|
@@ -3994,7 +4000,7 @@ blanket downgrade so those keep their severity; do not copy the two names into a
|
|
|
3994
4000
|
| `prefer-set-inputs` | `warn` | suggest | a run of `fixture.componentRef.setInput('title', v)` on one fixture → `await setInputs(fixture, { title: v })` — the name is resolved against the compiled definition before the first write (an undeclared one is an `NG0303` and no change) and the value is typed. The run collapses into one call and a `detectChanges()` under it goes; offered, not applied, because `stable()` ticks and a zone.js suite answers that with `NG0101` |
|
|
3995
4001
|
| `prefer-spy-on-own-method` | `warn` | `--fix` / suggest | `createSpyFromInstance(x, { onlyMethodsToSpyOn: ['m'], passthrough: true })` read for `m` alone — `.m` on the call, `const { m } = …`, a bare statement, or a name read only as `v.m` → `spyOnOwnMethod(x, 'm')`; the same whitelist with `returns: { m: undefined }` → `spyOnVoidMethod(x, 'm')`. Both fix, import and all; a `Spy<X>` annotation becomes `Spy<X>['m']` in a suggestion. A bare `returns: { m: undefined }` seed is a suggestion, offered only on a real event or element — `new MouseEvent(…)`, `document.createElement(…)`, `fixture.nativeElement` — never on a double |
|
|
3996
4002
|
| `prefer-observer-stub` | `error` | — | a hand-rolled observer global → `stubIntersectionObserver()` / `stubResizeObserver()` / `stubMutationObserver()`; the manual save-and-restore goes too, `restoreMockedProps()` runs the undo |
|
|
3997
|
-
| `no-hand-assigned-global` | `error` | `--fix` | a double assigned to a global (`global.fetch = vi.fn()`, `window.matchMedia = vi.fn()`, `window.localStorage = { getItem: vi.fn() }`) with no restore in `afterEach` / `afterAll` / `onTestFinished` → `mockValueProp(globalThis, name, value)` or `vi.stubGlobal` + `unstubGlobals`; `blockNetwork()` for network globals, `stubWebStorage()` for the storages
|
|
4003
|
+
| `no-hand-assigned-global` | `error` | `--fix` | a double assigned to a global (`global.fetch = vi.fn()`, `window.matchMedia = vi.fn()`, `window.localStorage = { getItem: vi.fn() }`) with no restore in `afterEach` / `afterAll` / `onTestFinished` → `mockValueProp(globalThis, name, value)` or `vi.stubGlobal` + `unstubGlobals`; `blockNetwork()` for network globals, `stubWebStorage()` for the storages, `stubWorker({ respond })` for `Worker`; the three observers stay with `prefer-observer-stub`; any value written into an imported object (`environment.production = true`) → `mockValueProp(environment, 'production', true)`, fixed in a test or `beforeEach` |
|
|
3998
4004
|
| `prefer-stub-response` | `error` | — | an object literal cast to `Response` (`as Response`, `as unknown as Response`, `<Response>{ … }`) or `createMock<Response>(…)` / `createAutoMock<Response>(…)` → `stubResponse({ body })` from `/setup`; the literal answers `undefined` for every member it does not list (`status`, `headers`, `text()`) and the cast is what makes that compile. `Response` must resolve to the **global**, so an Express handler's or a generated client's `Response` is never reported |
|
|
3999
4005
|
| `prefer-provide-activated-route` | `error` | — | a hand-built `ActivatedRoute` — any `useValue` / `useClass` / `useFactory` / `useExisting`, and `provideAutoSpy(ActivatedRoute)` too → `provideActivatedRoute({ … })`; the double knows either the streams or the snapshot, never both, and `injectActivatedRoute().setParams(…)` moves them together mid-test |
|
|
4000
4006
|
| `no-passthrough-console-spy` | `error` | suggest | `vi.spyOn(console, m)` nothing gives an implementation — it calls through and prints → `installConsoleSpies()` + `consoleXSpy`, or `.mockImplementation(() => undefined)` |
|
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,66 @@ The latest released version here must always match the one published on
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [5.32.2] - 2026-09-25
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **`no-hand-assigned-global` points a hand-assigned `Worker` at `stubWorker`.** `globalThis.Worker = …`
|
|
18
|
+
got the generic `handAssignedGlobal` message and the `stubConstructor` suggestion; it now gets its own
|
|
19
|
+
message naming `stubWorker({ respond })` from `/dom-stubs`, the way the storages name `stubWebStorage()`.
|
|
20
|
+
|
|
21
|
+
### Docs
|
|
22
|
+
|
|
23
|
+
- **The introduction no longer says the spy is powered by the runner's mock primitive.** Since 4.1 the
|
|
24
|
+
default engine is the library's own mock function; the introduction page and its Russian counterpart
|
|
25
|
+
now say so and name `setSpyEngine('runner')` as the way back to `vi.fn()`.
|
|
26
|
+
|
|
27
|
+
## [5.32.1] - 2026-09-25
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **`hostElement` and `queryElement` name the cause when handed the `null` of a query that matched
|
|
32
|
+
nothing.** Angular types `debugElement.query()` as `DebugElement`, but it returns `null` on a miss,
|
|
33
|
+
so `hostElement(fixture.debugElement.query(By.directive(Missing)))` type-checked and then died on
|
|
34
|
+
`Cannot read properties of null (reading 'nativeElement')`. Both helpers now throw their own
|
|
35
|
+
error, which asks whether a `debugElement.query()` matched nothing. Every message the two throw
|
|
36
|
+
now starts with `[vitest-auto-spy]` and ends with a `Docs:` link, like the rest of the package.
|
|
37
|
+
On `/angular` and `/bun-angular`.
|
|
38
|
+
- **`init` no longer passes over an old copy of the shipped skill.** A
|
|
39
|
+
`.claude/skills/vitest-auto-spy/SKILL.md` without the managed markers was left alone as
|
|
40
|
+
hand-written, and `init --check` said "Up to date" — even when it was a verbatim copy of the
|
|
41
|
+
package's skill from dozens of versions back. A file there whose frontmatter says
|
|
42
|
+
`name: vitest-auto-spy` is now listed as `stale`: `init` still does not overwrite it, but warns to
|
|
43
|
+
delete it and re-run `init`, which writes the managed pointer in its place, and `init --check`
|
|
44
|
+
exits 1 on it.
|
|
45
|
+
- **ESLint fixes import helpers from the adapter entry the spec already uses.** A fix or suggestion
|
|
46
|
+
that adds `mockValueProp`, `mockReadonlyPropGetter`, `asSpy`, `createMock` or `settleDynamicImport`
|
|
47
|
+
(`no-hand-assigned-global`, `no-object-define-property`, `no-reflect-member-access` and the other
|
|
48
|
+
rules that write them) always imported from the root, which in a `/bun`, `/bun-angular`, `/node`
|
|
49
|
+
or `/rstest` spec registered Vitest's adapter next to the runner's own. The import now joins the
|
|
50
|
+
adapter entry the file already imports, and falls back to the root only when it imports none.
|
|
51
|
+
|
|
52
|
+
### Docs
|
|
53
|
+
|
|
54
|
+
- **Reading text and asserting absence next to `queryElement`.** README, AGENTS.md, the skill and
|
|
55
|
+
the Angular page now show `queryElement(fixture, '.title').textContent.trim()` for an element that
|
|
56
|
+
must be there and `expect(host.querySelector('.x')).toBeNull()` for one that must not, and say why
|
|
57
|
+
`host.querySelector('.title')?.textContent.trim()` is the wrong reading: a miss is `undefined`, which
|
|
58
|
+
`toBeFalsy()` or `not.toContain()` accepts.
|
|
59
|
+
- **The API page lists what 5.32.0 exported.** A row for `stubAnimationFrame` / `stubElementRect`,
|
|
60
|
+
and the public types `AutoMocked<T>`, `ElementConstructor<E>`, `NativeElementHolder`,
|
|
61
|
+
`DialogDataOf<T, Token>`, `AnimationFrameStub`, `AnimationFrameStubOptions` and
|
|
62
|
+
`AnimationFrameMode`.
|
|
63
|
+
- **The docs site covers `autoMocked<T>()` and `AutoMocked<T>`.** The auto-mock page shows a double
|
|
64
|
+
passed as an argument and declared `let logger: AutoMocked<Logger>`; the README rows give the
|
|
65
|
+
`config` argument and name the type.
|
|
66
|
+
- **The Angular page carries the two dialog typing traps AGENTS.md already had.** Naming the type
|
|
67
|
+
argument of `provideMatDialogData` is what passes `no-unsafe-argument`, and the ref type goes in
|
|
68
|
+
the type argument of `injectMatDialogRef`, not in an instantiation expression.
|
|
69
|
+
- **`no-hand-assigned-global` says where its fix imports `mockValueProp` from.** The adapter entry
|
|
70
|
+
the file already imports, or `vitest-auto-spy` when it imports none, when the file has no
|
|
71
|
+
`mockValueProp` in scope; one imported from another entry is used as it is.
|
|
72
|
+
|
|
13
73
|
## [5.32.0] - 2026-09-25
|
|
14
74
|
|
|
15
75
|
### Added
|
|
@@ -8186,7 +8246,9 @@ by hand there, in more than one place, by more than one person.
|
|
|
8186
8246
|
`mockAccessorsProp`.
|
|
8187
8247
|
- Dual ESM + CJS build with type declarations; 100% test coverage.
|
|
8188
8248
|
|
|
8189
|
-
[Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.32.
|
|
8249
|
+
[Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.32.2...HEAD
|
|
8250
|
+
[5.32.2]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.32.1...v5.32.2
|
|
8251
|
+
[5.32.1]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.32.0...v5.32.1
|
|
8190
8252
|
[5.32.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.31.0...v5.32.0
|
|
8191
8253
|
[5.31.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.30.0...v5.31.0
|
|
8192
8254
|
[5.30.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.29.0...v5.30.0
|
package/README.md
CHANGED
|
@@ -2710,6 +2710,12 @@ or `Element` for markup that is not HTML. A selector that matches nothing throws
|
|
|
2710
2710
|
the selector in the message, and so does a match of another type:
|
|
2711
2711
|
`'.close' matched <a.close> (HTMLAnchorElement), not HTMLButtonElement`.
|
|
2712
2712
|
|
|
2713
|
+
Read text through `queryElement` too — `queryElement(fixture, '.title').textContent.trim()` — rather
|
|
2714
|
+
than `host.querySelector('.title')?.textContent.trim()`, whose miss is an `undefined` that
|
|
2715
|
+
`toBeFalsy()` or `not.toContain()` accepts. For an element that must be absent, keep
|
|
2716
|
+
`expect(host.querySelector('.empty-state')).toBeNull()`: `querySelector` on the typed host needs no
|
|
2717
|
+
cast.
|
|
2718
|
+
|
|
2713
2719
|
#### Building a class with auto-spied dependencies
|
|
2714
2720
|
|
|
2715
2721
|
```ts
|
|
@@ -3207,7 +3213,7 @@ single-purpose utility you can pick up independently — they all ride on the sa
|
|
|
3207
3213
|
| `registerResourceMatchers()` | `/angular/matchers` | Adds `toBeLoading` / `toHaveResourceValue` / `toHaveResourceError`; the value matcher fails an unresolved resource |
|
|
3208
3214
|
| `registerDirectiveMatchers()` | `/angular/matchers` | Adds `expect(fixture).toHaveDirectiveApplied(Directive, selector?)` |
|
|
3209
3215
|
| `installProxyZonePatch(opts?)` | `/zone` | `fakeAsync` / `waitForAsync` on Vitest — the patch `zone.js/testing` does not ship; `scope: 'callback'` per callback |
|
|
3210
|
-
| `autoMocked<T>(overrides?)`
|
|
3216
|
+
| `autoMocked<T>(overrides?, config?)` | core | `createAutoMock` typed as `T & Spy<T>`; `AutoMocked<T>` names it for a `let` (`AutoMocked<T>`), for a collaborator passed as an argument rather than injected |
|
|
3211
3217
|
| `mockSystemTime(time)` / `withSystemTime(time, fn)` | `/setup` | Freeze the clock whether or not fake timers are already running |
|
|
3212
3218
|
| `mockNow(source)` / `useCountingClock(opts?)` | `/setup` | A `Date.now` that survives fake timers being re-installed around every test; counts ticks instead of telling the time |
|
|
3213
3219
|
| `registerFocusMatchers()` | `/setup` | Adds `expect(el).toHaveFocus()`, which names _why_ focus is elsewhere |
|
|
@@ -4213,7 +4219,7 @@ another, and the next one is in that same file.
|
|
|
4213
4219
|
| `stubElementRect(el, rect?)` _(`/dom-stubs`)_ | A box for `getBoundingClientRect()` — missing fields `0`, edges derived; returns `RestoreProp` |
|
|
4214
4220
|
| `createComponentStub(Class, overrides?, opts?)` _(`/angular`)_ | A standalone stand-in for a child component, directive or pipe, built from its compiled definition so the selector cannot drift |
|
|
4215
4221
|
| `flushEventLoop(turns?)` / `settleDynamicImport(load, turns?)` | Real event-loop turns under fake timers; wait for a dynamic `import()` |
|
|
4216
|
-
| `autoMocked<T>(overrides?)`
|
|
4222
|
+
| `autoMocked<T>(overrides?, config?)` | `createAutoMock` typed as `T & Spy<T>`; `AutoMocked<T>` names it for a `let` |
|
|
4217
4223
|
| `mockSystemTime` / `withSystemTime` / `mockNow` / `useCountingClock` _(`/setup`)_ | Clock control that survives fake timers being re-installed per test |
|
|
4218
4224
|
| `registerFocusMatchers()` _(`/setup`)_ | Adds `expect(el).toHaveFocus()` |
|
|
4219
4225
|
| `overrideAutoSpy` / `overrideComponentProvider` / `assertNgModuleScopes` / `assertComponentDefIntact` _(Angular)_ | Override a component-level provider — and verify on the next fixture that the override applied; diagnose an NgModule with an empty runtime scope |
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { pendingRequestsReport, assertAngularInternals, instrumentTestBed, onTestingModuleConfigured, onComponentCreated, beforeTestBedReset, verifyOnTeardown } from './chunk-
|
|
2
|
-
export { disableTestBedDiagnostics, enableTestBedDiagnostics, formatSpecTiming, getTestBedTiming, instrumentTestBed, reportSpecTiming } from './chunk-
|
|
3
|
-
import { failOnUnspiedProvider } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
1
|
+
import { pendingRequestsReport, assertAngularInternals, instrumentTestBed, onTestingModuleConfigured, onComponentCreated, beforeTestBedReset, verifyOnTeardown } from './chunk-F2KBJC7P.js';
|
|
2
|
+
export { disableTestBedDiagnostics, enableTestBedDiagnostics, formatSpecTiming, getTestBedTiming, instrumentTestBed, reportSpecTiming } from './chunk-F2KBJC7P.js';
|
|
3
|
+
import { failOnUnspiedProvider } from './chunk-GSMWYZ5A.js';
|
|
4
|
+
import './chunk-YUGSITWJ.js';
|
|
5
|
+
import './chunk-6JQ7AFWM.js';
|
|
6
|
+
import './chunk-YDPOBKST.js';
|
|
7
|
+
import './chunk-CLQUJX6E.js';
|
|
8
8
|
import './chunk-PC3FAZT3.js';
|
|
9
|
-
import './chunk-
|
|
10
|
-
import { isAutoSpyLike } from './chunk-
|
|
9
|
+
import './chunk-72H6HNDI.js';
|
|
10
|
+
import { isAutoSpyLike } from './chunk-XNXIHKVM.js';
|
|
11
11
|
import { count, taskName } from './chunk-M3NTXLZG.js';
|
|
12
|
-
import { angularPendingRequests, angularShadowedProviders, angularDeadSchemas, angularNgModuleScopesAuto } from './chunk-
|
|
12
|
+
import { angularPendingRequests, angularShadowedProviders, angularDeadSchemas, angularNgModuleScopesAuto } from './chunk-JOPCMFYN.js';
|
|
13
13
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
14
14
|
import { getTestBed } from '@angular/core/testing';
|
|
15
15
|
import { beforeEach, afterEach } from 'vitest';
|
package/dist/angular-doubles.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { describeInstance } from './chunk-
|
|
2
|
-
import { useVitestAdapter } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { describeInstance } from './chunk-24JTFFQL.js';
|
|
2
|
+
import { useVitestAdapter } from './chunk-6JLBZHQ3.js';
|
|
3
|
+
import './chunk-JR55747M.js';
|
|
4
4
|
import './chunk-YHDBRBGU.js';
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
5
|
+
import './chunk-2QEM4WP7.js';
|
|
6
|
+
import './chunk-CLQUJX6E.js';
|
|
7
7
|
import './chunk-PC3FAZT3.js';
|
|
8
|
-
import { createFunctionSpy } from './chunk-
|
|
9
|
-
import './chunk-
|
|
8
|
+
import { createFunctionSpy } from './chunk-72H6HNDI.js';
|
|
9
|
+
import './chunk-XNXIHKVM.js';
|
|
10
10
|
import './chunk-M3NTXLZG.js';
|
|
11
|
-
import { angularDialog } from './chunk-
|
|
11
|
+
import { angularDialog } from './chunk-JOPCMFYN.js';
|
|
12
12
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
13
13
|
import { TestBed } from '@angular/core/testing';
|
|
14
14
|
import { ReplaySubject } from 'rxjs';
|
package/dist/angular-http.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { assertAngularInternals, pendingRequestsReport, verifyOnTeardown, beforeTestBedReset } from './chunk-
|
|
2
|
-
import { flushEffects } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { assertAngularInternals, pendingRequestsReport, verifyOnTeardown, beforeTestBedReset } from './chunk-F2KBJC7P.js';
|
|
2
|
+
import { flushEffects } from './chunk-DNXCZOYY.js';
|
|
3
|
+
import './chunk-YUGSITWJ.js';
|
|
4
4
|
import './chunk-W5EXSI22.js';
|
|
5
5
|
import { count, taskName } from './chunk-M3NTXLZG.js';
|
|
6
|
-
import { angularHttpNoRequest, angularHttpPending, angularHttpController, angularHttpExpectRequest } from './chunk-
|
|
6
|
+
import { angularHttpNoRequest, angularHttpPending, angularHttpController, angularHttpExpectRequest } from './chunk-JOPCMFYN.js';
|
|
7
7
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
8
8
|
import { provideHttpClient } from '@angular/common/http';
|
|
9
9
|
import { provideHttpClientTesting, HttpTestingController } from '@angular/common/http/testing';
|
package/dist/angular-matchers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { count } from './chunk-M3NTXLZG.js';
|
|
2
|
-
import { angularDirectiveApplied } from './chunk-
|
|
2
|
+
import { angularDirectiveApplied } from './chunk-JOPCMFYN.js';
|
|
3
3
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
4
4
|
import '@angular/compiler';
|
|
5
5
|
import { ɵSIGNAL as _SIGNAL, isStandalone } from '@angular/core';
|
package/dist/angular-router.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { describeInstance } from './chunk-
|
|
2
|
-
import { angularInternalsError } from './chunk-
|
|
3
|
-
import { createFunctionSpy } from './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
import { describeInstance } from './chunk-24JTFFQL.js';
|
|
2
|
+
import { angularInternalsError } from './chunk-YUGSITWJ.js';
|
|
3
|
+
import { createFunctionSpy } from './chunk-72H6HNDI.js';
|
|
4
|
+
import './chunk-XNXIHKVM.js';
|
|
5
5
|
import { count } from './chunk-M3NTXLZG.js';
|
|
6
|
-
import { angularRouteDouble, angularRouterInject, angularRouterEvents, angularLocationDouble, angularRouteWiring, angularRouterDouble } from './chunk-
|
|
6
|
+
import { angularRouteDouble, angularRouterInject, angularRouterEvents, angularLocationDouble, angularRouteWiring, angularRouterDouble } from './chunk-JOPCMFYN.js';
|
|
7
7
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
8
8
|
import { TestBed } from '@angular/core/testing';
|
|
9
9
|
import { Router, DefaultUrlSerializer, PRIMARY_OUTLET, RouterState, ActivatedRoute, NavigationEnd, RouterStateSnapshot, ActivatedRouteSnapshot, NavigationStart, NavigationCancel, NavigationError, NavigationSkipped, UrlSegment, VERSION, createUrlTreeFromSnapshot } from '@angular/router';
|
package/dist/angular.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { u as AngularTokenProvider, A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, E as ElementConstructor, N as NativeElementHolder, 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 hostElement, k as injectSpy, p as provideAutoSpy, v as provideAutoSpyForToken, q as queryElement, r as renderShallow, l as runEffect, s as setInputs, m as settleResource, n as stable, t as trackEffectRuns, o as trackRecomputations } from './track-signal-runs-
|
|
1
|
+
export { u as AngularTokenProvider, A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, E as ElementConstructor, N as NativeElementHolder, 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 hostElement, k as injectSpy, p as provideAutoSpy, v as provideAutoSpyForToken, q as queryElement, r as renderShallow, l as runEffect, s as setInputs, m as settleResource, n as stable, t as trackEffectRuns, o as trackRecomputations } from './track-signal-runs-BVbIBVS7.js';
|
|
2
2
|
import { InjectionToken, Provider, Type, WritableSignal, Signal } from '@angular/core';
|
|
3
3
|
import { A as AutoMockConfiguration, D as DeepReadonly } from './expect-emission-wUaoy0NW.js';
|
|
4
4
|
export { C as CallbackSubscribable, E as EmissionObserver, c as EmissionOptions, d as EmissionSource, S as SubscribableLike, h as expectAllEmissions, i as expectCompletion, j as expectEmission, k as expectEmissions, l as expectError, m as expectNoEmission, s as setEmissionTimeout } from './expect-emission-wUaoy0NW.js';
|
package/dist/angular.js
CHANGED
|
@@ -40,6 +40,7 @@ var angularMockResource = "https://asdalexey.github.io/vitest-auto-spy/adapters/
|
|
|
40
40
|
var angularResources = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#resources-httpresource-and-resource";
|
|
41
41
|
var angularSignalProp = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#signal-readonly-property-mocking";
|
|
42
42
|
var angularStable = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#zoneless-waiting";
|
|
43
|
+
var angularTypedElements = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#typed-elements-under-a-strict-lint";
|
|
43
44
|
var angularTrackRuns = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#counting-recomputations-and-effect-runs";
|
|
44
45
|
var autoMockByType = "https://asdalexey.github.io/vitest-auto-spy/core/auto-mock-by-type";
|
|
45
46
|
var autoMockHeldBack = "https://asdalexey.github.io/vitest-auto-spy/core/auto-mock-by-type#it-answers-everything-so-it-must-not-answer-these";
|
|
@@ -3694,18 +3695,31 @@ function describeElement(element) {
|
|
|
3694
3695
|
const classes = [...element.classList].map((name) => `.${name}`).join("");
|
|
3695
3696
|
return `<${element.tagName.toLowerCase()}${classes}> (${element.constructor.name})`;
|
|
3696
3697
|
}
|
|
3698
|
+
function fail(message) {
|
|
3699
|
+
return withDocs(`[vitest-auto-spy] ${message}`, angularTypedElements);
|
|
3700
|
+
}
|
|
3697
3701
|
function rootElement(helper, source) {
|
|
3702
|
+
if (source === null) {
|
|
3703
|
+
throw new TypeError(
|
|
3704
|
+
fail(
|
|
3705
|
+
`${helper}: received null instead of a ComponentFixture, a DebugElement or an Element \u2014 a debugElement.query() that matched nothing?
|
|
3706
|
+
Check the predicate against the rendered template, or use queryElement(fixture, selector), which names the selector on a miss.`
|
|
3707
|
+
)
|
|
3708
|
+
);
|
|
3709
|
+
}
|
|
3698
3710
|
const element = source instanceof Element ? source : source.nativeElement;
|
|
3699
3711
|
if (!(element instanceof Element)) {
|
|
3700
3712
|
throw new TypeError(
|
|
3701
|
-
|
|
3713
|
+
fail(
|
|
3714
|
+
`${helper}: expected a ComponentFixture, a DebugElement or an Element, received a nativeElement of ${element === null ? "null" : typeof element}.`
|
|
3715
|
+
)
|
|
3702
3716
|
);
|
|
3703
3717
|
}
|
|
3704
3718
|
return element;
|
|
3705
3719
|
}
|
|
3706
3720
|
function checkType(element, type, what, helper) {
|
|
3707
3721
|
if (!(element instanceof type)) {
|
|
3708
|
-
throw new TypeError(`${helper}: ${what} ${describeElement(element)}, not ${type.name}.`);
|
|
3722
|
+
throw new TypeError(fail(`${helper}: ${what} ${describeElement(element)}, not ${type.name}.`));
|
|
3709
3723
|
}
|
|
3710
3724
|
return element;
|
|
3711
3725
|
}
|
|
@@ -3717,8 +3731,10 @@ function queryElement(source, selector, type = HTMLElement) {
|
|
|
3717
3731
|
const match = root.querySelector(selector);
|
|
3718
3732
|
if (match === null) {
|
|
3719
3733
|
throw new Error(
|
|
3720
|
-
|
|
3734
|
+
fail(
|
|
3735
|
+
`queryElement: no element matches '${selector}' inside ${describeElement(root)}.
|
|
3721
3736
|
Render first (\`fixture.detectChanges()\` or \`await stable(fixture)\`), then check the selector against the template.`
|
|
3737
|
+
)
|
|
3722
3738
|
);
|
|
3723
3739
|
}
|
|
3724
3740
|
return checkType(match, type, `'${selector}' matched`, "queryElement");
|
|
@@ -4511,7 +4527,7 @@ function collectingObserver(collected, context, settle, handlers) {
|
|
|
4511
4527
|
const options = context.options;
|
|
4512
4528
|
const skip = options?.skip ?? 0;
|
|
4513
4529
|
const until = options?.until;
|
|
4514
|
-
const
|
|
4530
|
+
const fail2 = (error) => {
|
|
4515
4531
|
collected.stop();
|
|
4516
4532
|
settle.reject(
|
|
4517
4533
|
emissionFailure(
|
|
@@ -4533,7 +4549,7 @@ function collectingObserver(collected, context, settle, handlers) {
|
|
|
4533
4549
|
settle.resolve(collected.accepted, collected.subscribing);
|
|
4534
4550
|
}
|
|
4535
4551
|
} catch (error) {
|
|
4536
|
-
|
|
4552
|
+
fail2(error);
|
|
4537
4553
|
}
|
|
4538
4554
|
},
|
|
4539
4555
|
error: (error) => {
|
|
@@ -4643,16 +4659,16 @@ function collectEmissions(source$, count2, options, anchor2, helper) {
|
|
|
4643
4659
|
);
|
|
4644
4660
|
}
|
|
4645
4661
|
return new Promise((resolve, reject) => {
|
|
4646
|
-
const
|
|
4662
|
+
const fail2 = anchoredRejecter(reject, anchor2);
|
|
4647
4663
|
subscribeAndCollect(
|
|
4648
4664
|
source$,
|
|
4649
4665
|
options,
|
|
4650
4666
|
// Resolved with everything that arrived, then narrowed to the accepted ones: the collector's
|
|
4651
4667
|
// job is to record, and `skip` / `until` decide what the caller is handed.
|
|
4652
|
-
{ resolve: (values) => resolve(values.slice(0, count2)), reject:
|
|
4668
|
+
{ resolve: (values) => resolve(values.slice(0, count2)), reject: fail2 },
|
|
4653
4669
|
{
|
|
4654
4670
|
isDone: (acceptedCount) => acceptedCount >= count2,
|
|
4655
|
-
onComplete: (_values, received) =>
|
|
4671
|
+
onComplete: (_values, received) => fail2(completedError(received, { helper, options, expected: count2 })),
|
|
4656
4672
|
onTimeout: timeoutError,
|
|
4657
4673
|
onError: rejectAsSourceError,
|
|
4658
4674
|
emissionsSettle: true,
|
|
@@ -4668,13 +4684,13 @@ function expectNoEmission(source$, options) {
|
|
|
4668
4684
|
let quietWindow = void 0;
|
|
4669
4685
|
const context = { helper: "expectNoEmission", options, expected: 1 };
|
|
4670
4686
|
return new Promise((resolve, reject) => {
|
|
4671
|
-
const
|
|
4687
|
+
const fail2 = anchoredRejecter(reject, anchor2);
|
|
4672
4688
|
const collector = subscribeAndCollect(
|
|
4673
4689
|
source$,
|
|
4674
4690
|
{ ...options, timeout: 0 },
|
|
4675
4691
|
{
|
|
4676
|
-
resolve: (emitted, onSubscribe) =>
|
|
4677
|
-
reject:
|
|
4692
|
+
resolve: (emitted, onSubscribe) => fail2(unexpectedEmissionError(emitted, context, onSubscribe)),
|
|
4693
|
+
reject: fail2
|
|
4678
4694
|
},
|
|
4679
4695
|
{
|
|
4680
4696
|
isDone: (acceptedCount) => acceptedCount > 0,
|
|
@@ -4746,15 +4762,15 @@ function expectError(source$, options) {
|
|
|
4746
4762
|
const anchor2 = captureAnchor(expectError);
|
|
4747
4763
|
const context = { helper: "expectError", options, expected: 0 };
|
|
4748
4764
|
return new Promise((resolve, reject) => {
|
|
4749
|
-
const
|
|
4765
|
+
const fail2 = anchoredRejecter(reject, anchor2);
|
|
4750
4766
|
subscribeAndCollect(
|
|
4751
4767
|
source$,
|
|
4752
4768
|
options,
|
|
4753
|
-
{ resolve, reject:
|
|
4769
|
+
{ resolve, reject: fail2 },
|
|
4754
4770
|
{
|
|
4755
4771
|
// Only `error` settles this one: an emission is not the answer, and neither is completion.
|
|
4756
4772
|
isDone: staysOpen,
|
|
4757
|
-
onComplete: (_values, received) =>
|
|
4773
|
+
onComplete: (_values, received) => fail2(completedWithoutErrorError(received, context)),
|
|
4758
4774
|
onTimeout: notErroredError,
|
|
4759
4775
|
onError: resolveWithError,
|
|
4760
4776
|
emissionsSettle: false,
|
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 AutoMocked, b as AutoSpyDefaultEntry, C as CallbackSubscribable, E as EmissionObserver, c as EmissionOptions, d as EmissionSource, S as SubscribableLike, e as autoMocked, f as clearAutoSpyDefaults, g as createAutoMock, h as expectAllEmissions, i as expectCompletion, j as expectEmission, k as expectEmissions, l as expectError, m as expectNoEmission, r as registerAutoSpyDefaults, s as setEmissionTimeout } from './expect-emission-wUaoy0NW.js';
|
|
4
4
|
export { c as createFunctionSpy, d as describeDuplicateCopies, g as getPackageCopies } from './package-identity-5pFBRWW9.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-DUcl1uMH.js';
|
|
6
|
-
export { A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, E as ElementConstructor, N as NativeElementHolder, 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 hostElement, k as injectSpy, p as provideAutoSpy, q as queryElement, r as renderShallow, l as runEffect, s as setInputs, m as settleResource, n as stable, t as trackEffectRuns, o as trackRecomputations } from './track-signal-runs-
|
|
6
|
+
export { A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, E as ElementConstructor, N as NativeElementHolder, 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 hostElement, k as injectSpy, p as provideAutoSpy, q as queryElement, r as renderShallow, l as runEffect, s as setInputs, m as settleResource, n as stable, t as trackEffectRuns, o as trackRecomputations } from './track-signal-runs-BVbIBVS7.js';
|
|
7
7
|
import 'vitest';
|
|
8
8
|
import '@angular/core';
|
|
9
9
|
import '@angular/core/testing';
|
package/dist/bun-angular.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { createSpyForToken } from './chunk-
|
|
2
|
-
export { injectSpy, provideAutoSpy } from './chunk-
|
|
3
|
-
import { stable, flushEffects } from './chunk-
|
|
4
|
-
export { flushEffects, stable } from './chunk-
|
|
5
|
-
import { angularInternalsError } from './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createLog, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectAllEmissions, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, outOfType, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, spyOnOwnMethod, spyOnVoidMethod, stubConstructor, withOverrides } from './chunk-
|
|
8
|
-
import { mockValueProp } from './chunk-
|
|
9
|
-
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-
|
|
10
|
-
import { closestName } from './chunk-
|
|
11
|
-
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-
|
|
1
|
+
import { createSpyForToken } from './chunk-7WM3A4IB.js';
|
|
2
|
+
export { injectSpy, provideAutoSpy } from './chunk-GSMWYZ5A.js';
|
|
3
|
+
import { stable, flushEffects } from './chunk-DNXCZOYY.js';
|
|
4
|
+
export { flushEffects, stable } from './chunk-DNXCZOYY.js';
|
|
5
|
+
import { angularInternalsError } from './chunk-YUGSITWJ.js';
|
|
6
|
+
import './chunk-XUPBHHJD.js';
|
|
7
|
+
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createLog, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectAllEmissions, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, outOfType, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, spyOnOwnMethod, spyOnVoidMethod, stubConstructor, withOverrides } from './chunk-TMFV4DXT.js';
|
|
8
|
+
import { mockValueProp } from './chunk-6JQ7AFWM.js';
|
|
9
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-6JQ7AFWM.js';
|
|
10
|
+
import { closestName } from './chunk-YDPOBKST.js';
|
|
11
|
+
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-YDPOBKST.js';
|
|
12
12
|
import { fakeClockBacklog } from './chunk-W5EXSI22.js';
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
13
|
+
import './chunk-2QEM4WP7.js';
|
|
14
|
+
import './chunk-CLQUJX6E.js';
|
|
15
15
|
import './chunk-PC3FAZT3.js';
|
|
16
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
17
|
-
import { libraryWarn } from './chunk-
|
|
16
|
+
export { createFunctionSpy, errorHandler } from './chunk-72H6HNDI.js';
|
|
17
|
+
import { libraryWarn } from './chunk-XNXIHKVM.js';
|
|
18
18
|
import { displayPath, count } from './chunk-M3NTXLZG.js';
|
|
19
|
-
import { angularEffects, angularTrackRuns, bunAngular, angularUnreadResource, angularCreateWithAutoSpies, angularResources, angularInputs, angularKeepTemplate } from './chunk-
|
|
19
|
+
import { angularEffects, angularTrackRuns, bunAngular, angularUnreadResource, angularCreateWithAutoSpies, angularResources, angularTypedElements, angularInputs, angularKeepTemplate } from './chunk-JOPCMFYN.js';
|
|
20
20
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
21
21
|
import '@angular/compiler';
|
|
22
22
|
import { NgModule, provideZonelessChangeDetection, Injector, runInInjectionContext, NO_ERRORS_SCHEMA, untracked, ɵSIGNAL as _SIGNAL } from '@angular/core';
|
|
@@ -289,18 +289,31 @@ function describeElement(element) {
|
|
|
289
289
|
const classes = [...element.classList].map((name) => `.${name}`).join("");
|
|
290
290
|
return `<${element.tagName.toLowerCase()}${classes}> (${element.constructor.name})`;
|
|
291
291
|
}
|
|
292
|
+
function fail(message) {
|
|
293
|
+
return withDocs(`[vitest-auto-spy] ${message}`, angularTypedElements);
|
|
294
|
+
}
|
|
292
295
|
function rootElement(helper, source) {
|
|
296
|
+
if (source === null) {
|
|
297
|
+
throw new TypeError(
|
|
298
|
+
fail(
|
|
299
|
+
`${helper}: received null instead of a ComponentFixture, a DebugElement or an Element \u2014 a debugElement.query() that matched nothing?
|
|
300
|
+
Check the predicate against the rendered template, or use queryElement(fixture, selector), which names the selector on a miss.`
|
|
301
|
+
)
|
|
302
|
+
);
|
|
303
|
+
}
|
|
293
304
|
const element = source instanceof Element ? source : source.nativeElement;
|
|
294
305
|
if (!(element instanceof Element)) {
|
|
295
306
|
throw new TypeError(
|
|
296
|
-
|
|
307
|
+
fail(
|
|
308
|
+
`${helper}: expected a ComponentFixture, a DebugElement or an Element, received a nativeElement of ${element === null ? "null" : typeof element}.`
|
|
309
|
+
)
|
|
297
310
|
);
|
|
298
311
|
}
|
|
299
312
|
return element;
|
|
300
313
|
}
|
|
301
314
|
function checkType(element, type, what, helper) {
|
|
302
315
|
if (!(element instanceof type)) {
|
|
303
|
-
throw new TypeError(`${helper}: ${what} ${describeElement(element)}, not ${type.name}.`);
|
|
316
|
+
throw new TypeError(fail(`${helper}: ${what} ${describeElement(element)}, not ${type.name}.`));
|
|
304
317
|
}
|
|
305
318
|
return element;
|
|
306
319
|
}
|
|
@@ -312,8 +325,10 @@ function queryElement(source, selector, type = HTMLElement) {
|
|
|
312
325
|
const match = root.querySelector(selector);
|
|
313
326
|
if (match === null) {
|
|
314
327
|
throw new Error(
|
|
315
|
-
|
|
328
|
+
fail(
|
|
329
|
+
`queryElement: no element matches '${selector}' inside ${describeElement(root)}.
|
|
316
330
|
Render first (\`fixture.detectChanges()\` or \`await stable(fixture)\`), then check the selector against the template.`
|
|
331
|
+
)
|
|
317
332
|
);
|
|
318
333
|
}
|
|
319
334
|
return checkType(match, type, `'${selector}' matched`, "queryElement");
|
package/dist/bun.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import './chunk-
|
|
2
|
-
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createLog, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectAllEmissions, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, outOfType, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, spyOnOwnMethod, spyOnVoidMethod, stubConstructor, withOverrides } from './chunk-
|
|
3
|
-
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-
|
|
4
|
-
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-
|
|
1
|
+
import './chunk-XUPBHHJD.js';
|
|
2
|
+
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createLog, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectAllEmissions, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, outOfType, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, spyOnOwnMethod, spyOnVoidMethod, stubConstructor, withOverrides } from './chunk-TMFV4DXT.js';
|
|
3
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-6JQ7AFWM.js';
|
|
4
|
+
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-YDPOBKST.js';
|
|
5
5
|
import './chunk-W5EXSI22.js';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
6
|
+
import './chunk-2QEM4WP7.js';
|
|
7
|
+
import './chunk-CLQUJX6E.js';
|
|
8
8
|
import './chunk-PC3FAZT3.js';
|
|
9
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
10
|
-
import './chunk-
|
|
9
|
+
export { createFunctionSpy, errorHandler } from './chunk-72H6HNDI.js';
|
|
10
|
+
import './chunk-XNXIHKVM.js';
|
|
11
11
|
import './chunk-M3NTXLZG.js';
|
|
12
|
-
import './chunk-
|
|
12
|
+
import './chunk-JOPCMFYN.js';
|
|
13
13
|
import './chunk-ENCEEH23.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { clearAllFastSpies, resetAllFastSpies, getSpyEngine, createFastSpy } from './chunk-
|
|
1
|
+
import { clearAllFastSpies, resetAllFastSpies, getSpyEngine, createFastSpy } from './chunk-JR55747M.js';
|
|
2
2
|
import { SWEEP_SENTINEL } from './chunk-YHDBRBGU.js';
|
|
3
|
-
import { guardAccessorSpies, spyOnAccessorByRedefine } from './chunk-
|
|
3
|
+
import { guardAccessorSpies, spyOnAccessorByRedefine } from './chunk-2QEM4WP7.js';
|
|
4
4
|
import { hasMockAdapter, registerMockAdapter } from './shared-state.js';
|
|
5
5
|
import { vi } from 'vitest';
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isCannotRedefine, redefineFailure } from './chunk-
|
|
2
|
-
import { libraryWarn } from './chunk-
|
|
1
|
+
import { isCannotRedefine, redefineFailure } from './chunk-CLQUJX6E.js';
|
|
2
|
+
import { libraryWarn } from './chunk-XNXIHKVM.js';
|
|
3
3
|
import { count, displayPath } from './chunk-M3NTXLZG.js';
|
|
4
|
-
import { setupGlobals, setupWrongHook, setup } from './chunk-
|
|
4
|
+
import { setupGlobals, setupWrongHook, setup } from './chunk-JOPCMFYN.js';
|
|
5
5
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
6
6
|
import { getMockAdapter } from './shared-state.js';
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AUTO_SPY_MARK, attachHelpers, markAsMock, reportMisconfiguration, detachedHelperError, decorate } from './chunk-
|
|
1
|
+
import { AUTO_SPY_MARK, attachHelpers, markAsMock, reportMisconfiguration, detachedHelperError, decorate } from './chunk-XNXIHKVM.js';
|
|
2
2
|
import { displayPath } from './chunk-M3NTXLZG.js';
|
|
3
|
-
import { mustBeCalledWith, strictCall, createSpyFromClass } from './chunk-
|
|
3
|
+
import { mustBeCalledWith, strictCall, createSpyFromClass } from './chunk-JOPCMFYN.js';
|
|
4
4
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
5
5
|
import { getMockAdapter, getObservableSupport, getJasmineSupport, requireObservableSupport } from './shared-state.js';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createSpyFromClass, createAutoMock } from './chunk-
|
|
2
|
-
import { trackInjectionsUntracked } from './chunk-
|
|
1
|
+
import { createSpyFromClass, createAutoMock } from './chunk-YDPOBKST.js';
|
|
2
|
+
import { trackInjectionsUntracked } from './chunk-JOPCMFYN.js';
|
|
3
3
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
4
4
|
|
|
5
5
|
// src/lib/track-injections.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { realSeam, createSpyFromClass, autoMockByType, createSpyFromClassAccessorSpies } from './chunk-
|
|
1
|
+
import { realSeam, createSpyFromClass, autoMockByType, createSpyFromClassAccessorSpies } from './chunk-JOPCMFYN.js';
|
|
2
2
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
3
3
|
|
|
4
4
|
// src/lib/redefine-failure.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { unpatchedSetTimeout, unpatchedClearTimeout, fakeClockBacklog } from './chunk-W5EXSI22.js';
|
|
2
2
|
import { count } from './chunk-M3NTXLZG.js';
|
|
3
|
-
import { angularStable } from './chunk-
|
|
3
|
+
import { angularStable } from './chunk-JOPCMFYN.js';
|
|
4
4
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
5
5
|
import { NgZone } from '@angular/core';
|
|
6
6
|
import { TestBed } from '@angular/core/testing';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { angularInternalsError } from './chunk-
|
|
1
|
+
import { angularInternalsError } from './chunk-YUGSITWJ.js';
|
|
2
2
|
import { count } from './chunk-M3NTXLZG.js';
|
|
3
3
|
import { TestBed, getTestBed } from '@angular/core/testing';
|
|
4
4
|
import { expect, beforeAll, afterAll } from 'vitest';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { currentSpecFile } from './chunk-
|
|
2
|
-
import { createSpyFromClass } from './chunk-
|
|
3
|
-
import { isAutoSpyLike, misconfigurationThrows, reportMisconfiguration } from './chunk-
|
|
4
|
-
import { angularInjectSpyReal } from './chunk-
|
|
1
|
+
import { currentSpecFile } from './chunk-6JQ7AFWM.js';
|
|
2
|
+
import { createSpyFromClass } from './chunk-YDPOBKST.js';
|
|
3
|
+
import { isAutoSpyLike, misconfigurationThrows, reportMisconfiguration } from './chunk-XNXIHKVM.js';
|
|
4
|
+
import { angularInjectSpyReal } from './chunk-JOPCMFYN.js';
|
|
5
5
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
6
6
|
import { TestBed } from '@angular/core/testing';
|
|
7
7
|
|
|
@@ -24,6 +24,7 @@ var angularShadowedProviders = "https://asdalexey.github.io/vitest-auto-spy/adap
|
|
|
24
24
|
var angularEffects = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#running-one-effect-on-demand";
|
|
25
25
|
var angularResources = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#resources-httpresource-and-resource";
|
|
26
26
|
var angularStable = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#zoneless-waiting";
|
|
27
|
+
var angularTypedElements = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#typed-elements-under-a-strict-lint";
|
|
27
28
|
var angularTrackRuns = "https://asdalexey.github.io/vitest-auto-spy/adapters/angular#counting-recomputations-and-effect-runs";
|
|
28
29
|
var angularUnreadResource = "https://asdalexey.github.io/vitest-auto-spy/runtimes/bun-angular#a-template-or-stylesheet-that-cannot-be-read";
|
|
29
30
|
var autoMockByType = "https://asdalexey.github.io/vitest-auto-spy/core/auto-mock-by-type";
|
|
@@ -62,4 +63,4 @@ var strictModePassthrough = "https://asdalexey.github.io/vitest-auto-spy/core/st
|
|
|
62
63
|
var trackInjectionsUntracked = "https://asdalexey.github.io/vitest-auto-spy/utilities/track-injections#get-on-a-token-that-is-not-tracked";
|
|
63
64
|
var zoneRequirements = "https://asdalexey.github.io/vitest-auto-spy/utilities/zone#requirements";
|
|
64
65
|
|
|
65
|
-
export { adoptMock, angularCreateWithAutoSpies, angularDeadSchemas, angularDialog, angularDirectiveApplied, angularEffects, angularHttpController, angularHttpExpectRequest, angularHttpNoRequest, angularHttpPending, angularInjectSpyReal, angularInputs, angularInternals, angularKeepTemplate, angularLocationDouble, angularNgModuleScopesAuto, angularPendingRequests, angularResources, angularRouteDouble, angularRouteWiring, angularRouterDouble, angularRouterEvents, angularRouterInject, angularShadowedProviders, angularStable, angularTrackRuns, angularUnreadResource, autoMockByType, autoMockHeldBack, bunAngular, captureArg, controlHelpers, createSpyFromClass, createSpyFromClassAccessorSpies, createSpyFromClassAccessors, createSpyFromClassInstanceMethods, createSpyFromClassLazySpies, createSpyFromClassReturns, eventLoopUntil, jasmineAutoSpies, jasmineClock, jasmineGlobals, jasmineTimeout, jasmineWithArgs, mockConstructor, moduleMocksAssert, moduleMocksNoOp, mustBeCalledWith, narrow, nestUnitRefusals, nextWithValuesLate, observableFailures, realSeam, setup, setupGlobals, setupWrongHook, signalFormsCreate, signalFormsErrors, strictCall, strictModePassthrough, trackInjectionsUntracked, zoneRequirements };
|
|
66
|
+
export { adoptMock, angularCreateWithAutoSpies, angularDeadSchemas, angularDialog, angularDirectiveApplied, angularEffects, angularHttpController, angularHttpExpectRequest, angularHttpNoRequest, angularHttpPending, angularInjectSpyReal, angularInputs, angularInternals, angularKeepTemplate, angularLocationDouble, angularNgModuleScopesAuto, angularPendingRequests, angularResources, angularRouteDouble, angularRouteWiring, angularRouterDouble, angularRouterEvents, angularRouterInject, angularShadowedProviders, angularStable, angularTrackRuns, angularTypedElements, angularUnreadResource, autoMockByType, autoMockHeldBack, bunAngular, captureArg, controlHelpers, createSpyFromClass, createSpyFromClassAccessorSpies, createSpyFromClassAccessors, createSpyFromClassInstanceMethods, createSpyFromClassLazySpies, createSpyFromClassReturns, eventLoopUntil, jasmineAutoSpies, jasmineClock, jasmineGlobals, jasmineTimeout, jasmineWithArgs, mockConstructor, moduleMocksAssert, moduleMocksNoOp, mustBeCalledWith, narrow, nestUnitRefusals, nextWithValuesLate, observableFailures, realSeam, setup, setupGlobals, setupWrongHook, signalFormsCreate, signalFormsErrors, strictCall, strictModePassthrough, trackInjectionsUntracked, zoneRequirements };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DISPOSE } from './chunk-PC3FAZT3.js';
|
|
2
|
-
import { isFastSpy, FAST_SPY_BRAND, isThenable } from './chunk-
|
|
3
|
-
import { setSharedHelperSink, hooksOf } from './chunk-
|
|
4
|
-
import { mockConstructor } from './chunk-
|
|
2
|
+
import { isFastSpy, FAST_SPY_BRAND, isThenable } from './chunk-72H6HNDI.js';
|
|
3
|
+
import { setSharedHelperSink, hooksOf } from './chunk-XNXIHKVM.js';
|
|
4
|
+
import { mockConstructor } from './chunk-JOPCMFYN.js';
|
|
5
5
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
6
6
|
|
|
7
7
|
// src/lib/fast-spy.ts
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { mockValueProp, mockAccessorsProp } from './chunk-
|
|
2
|
-
import { resolveConfiguration, mergeAutoSpyDefaults, resolveReadGuard, mergeMethodNames, getCallableMemberNames, createTrackedPropSpy, applyConfiguredReturns, createSpyFromClass, warnOnUnknownMethods, warnOnAccessorNamingAMethod, resolveAccessors, createAccessorsSpies, ownerOf, createProxyPropStore, storeWriteTraps, describeStoredProp, hasStoredProp, isProtocolKey, isDeletedProp, readStoredAccessor, NOT_STORED, disposeAutoSpy, writeStoredValue } from './chunk-
|
|
1
|
+
import { mockValueProp, mockAccessorsProp } from './chunk-6JQ7AFWM.js';
|
|
2
|
+
import { resolveConfiguration, mergeAutoSpyDefaults, resolveReadGuard, mergeMethodNames, getCallableMemberNames, createTrackedPropSpy, applyConfiguredReturns, createSpyFromClass, warnOnUnknownMethods, warnOnAccessorNamingAMethod, resolveAccessors, createAccessorsSpies, ownerOf, createProxyPropStore, storeWriteTraps, describeStoredProp, hasStoredProp, isProtocolKey, isDeletedProp, readStoredAccessor, NOT_STORED, disposeAutoSpy, writeStoredValue } from './chunk-YDPOBKST.js';
|
|
3
3
|
import { unpatchedSetTimeout, unpatchedClearTimeout, fakeClockAdvice, fakeClockBacklog } from './chunk-W5EXSI22.js';
|
|
4
|
-
import { redefineFailure } from './chunk-
|
|
4
|
+
import { redefineFailure } from './chunk-CLQUJX6E.js';
|
|
5
5
|
import { DISPOSE } from './chunk-PC3FAZT3.js';
|
|
6
|
-
import { defineHelper, adoptFunctionSpy, reinstallDispatch, serializeValue, resolveUnstubbedGuard, createFunctionSpy } from './chunk-
|
|
7
|
-
import { isMarkedMock, reportMisconfiguration, DEEP_CHILDREN } from './chunk-
|
|
6
|
+
import { defineHelper, adoptFunctionSpy, reinstallDispatch, serializeValue, resolveUnstubbedGuard, createFunctionSpy } from './chunk-72H6HNDI.js';
|
|
7
|
+
import { isMarkedMock, reportMisconfiguration, DEEP_CHILDREN } from './chunk-XNXIHKVM.js';
|
|
8
8
|
import { count, displayPath } from './chunk-M3NTXLZG.js';
|
|
9
|
-
import { moduleMocksAssert, moduleMocksNoOp, narrow, adoptMock, observableFailures, strictModePassthrough, createSpyFromClassReturns, captureArg, eventLoopUntil, mockConstructor } from './chunk-
|
|
9
|
+
import { moduleMocksAssert, moduleMocksNoOp, narrow, adoptMock, observableFailures, strictModePassthrough, createSpyFromClassReturns, captureArg, eventLoopUntil, mockConstructor } from './chunk-JOPCMFYN.js';
|
|
10
10
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
11
11
|
import { getMockAdapter, emissionTimeout, registerEmissionWait, forgetEmissionWait } from './shared-state.js';
|
|
12
12
|
export { describeDuplicateCopies, getPackageCopies, setEmissionTimeout } from './shared-state.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DISPOSE } from './chunk-PC3FAZT3.js';
|
|
2
|
-
import { defaultStrict, resolveUnstubbedGuard, seedReturnValue, createFunctionSpy } from './chunk-
|
|
3
|
-
import { runClearHook, runConfigReset, reportMisconfiguration, AUTO_SPY_MARK, markAsMock, isMarkedMock, readDeepChildren } from './chunk-
|
|
4
|
-
import { autoMockHeldBack, createSpyFromClassInstanceMethods, createSpyFromClassAccessors, createSpyFromClassReturns, createSpyFromClassLazySpies } from './chunk-
|
|
2
|
+
import { defaultStrict, resolveUnstubbedGuard, seedReturnValue, createFunctionSpy } from './chunk-72H6HNDI.js';
|
|
3
|
+
import { runClearHook, runConfigReset, reportMisconfiguration, AUTO_SPY_MARK, markAsMock, isMarkedMock, readDeepChildren } from './chunk-XNXIHKVM.js';
|
|
4
|
+
import { autoMockHeldBack, createSpyFromClassInstanceMethods, createSpyFromClassAccessors, createSpyFromClassReturns, createSpyFromClassLazySpies } from './chunk-JOPCMFYN.js';
|
|
5
5
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
6
6
|
import { getMockAdapter, requireObservableSupport, getJasmineSupport } from './shared-state.js';
|
|
7
7
|
|
package/dist/cli.js
CHANGED
|
@@ -3204,7 +3204,7 @@ function checkForeignPragma(graph) {
|
|
|
3204
3204
|
}
|
|
3205
3205
|
|
|
3206
3206
|
// src/cli/checks/export-map.generated.ts
|
|
3207
|
-
var EXPORT_MAP_VERSION = "5.
|
|
3207
|
+
var EXPORT_MAP_VERSION = "5.32.1";
|
|
3208
3208
|
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 vitest-auto-spy/perf-reporter";
|
|
3209
3209
|
var EXPORTED_BY = {
|
|
3210
3210
|
AccessorImplementations: "0 1 2 3 4 12 20 21 22",
|
|
@@ -4730,6 +4730,9 @@ function isStampOnly(plan) {
|
|
|
4730
4730
|
}
|
|
4731
4731
|
var STAMP_ONLY_NOTE = "only the version stamp differs, which `--check` does not count; a plain `init` refreshes it";
|
|
4732
4732
|
function statusOf(plan, check) {
|
|
4733
|
+
if (plan.staleCopy === true) {
|
|
4734
|
+
return "stale";
|
|
4735
|
+
}
|
|
4733
4736
|
if (plan.desired === void 0) {
|
|
4734
4737
|
return "skipped";
|
|
4735
4738
|
}
|
|
@@ -4755,9 +4758,14 @@ function collectTargets(profile, only) {
|
|
|
4755
4758
|
function readTarget(cwd, target) {
|
|
4756
4759
|
return pathExists(join(cwd, target.path)) ? readTextFile(join(cwd, target.path)) : void 0;
|
|
4757
4760
|
}
|
|
4761
|
+
function isShippedSkillCopy(content) {
|
|
4762
|
+
const frontmatter = /^---\r?\n([\S\s]*?)\r?\n---/.exec(content)?.[1] ?? "";
|
|
4763
|
+
return /^name:\s*(["']?)vitest-auto-spy\1\s*$/m.test(frontmatter);
|
|
4764
|
+
}
|
|
4765
|
+
var STALE_COPY_NOTE = "a copy of the shipped skill that init did not write \u2014 frozen at the version it was copied from";
|
|
4758
4766
|
function skillPlan(plan, version, frontmatter) {
|
|
4759
4767
|
if (plan.desired === void 0 && plan.existing !== void 0) {
|
|
4760
|
-
return plan;
|
|
4768
|
+
return isShippedSkillCopy(plan.existing) ? { ...plan, staleCopy: true, note: STALE_COPY_NOTE } : plan;
|
|
4761
4769
|
}
|
|
4762
4770
|
if (frontmatter === void 0) {
|
|
4763
4771
|
return { ...plan, desired: void 0, note: "the shipped skill could not be read \u2014 skipped" };
|
|
@@ -4824,7 +4832,7 @@ function budgetWarnings(plans) {
|
|
|
4824
4832
|
}
|
|
4825
4833
|
function untouchedWarnings(plans) {
|
|
4826
4834
|
return plans.filter((plan) => plan.desired === void 0 && plan.existing !== void 0 && plan.target.kind === "owned").map(
|
|
4827
|
-
(plan) => `${plan.target.path} exists and was not written by init \u2014 left untouched; fold it into the managed block by hand if you want init to own it.`
|
|
4835
|
+
(plan) => plan.staleCopy === true ? `${plan.target.path} is a copy of the shipped vitest-auto-spy skill, not written by init, so no upgrade refreshes it \u2014 left untouched. Delete it and re-run \`npx vitest-auto-spy init\` to replace it with the managed pointer.` : `${plan.target.path} exists and was not written by init \u2014 left untouched; fold it into the managed block by hand if you want init to own it.`
|
|
4828
4836
|
);
|
|
4829
4837
|
}
|
|
4830
4838
|
function unmatchedWarnings(only) {
|
|
@@ -4837,7 +4845,7 @@ function unmatchedWarnings(only) {
|
|
|
4837
4845
|
function runInit(profile, version, options) {
|
|
4838
4846
|
const plans = buildPlans(profile, version, options.only).map((plan) => options.uninstall ? uninstallPlan(plan) : plan);
|
|
4839
4847
|
const actions = plans.map((plan) => applyPlan(profile.cwd, plan, options));
|
|
4840
|
-
const pending = actions.some((action) => action.status === "created" || action.status === "updated");
|
|
4848
|
+
const pending = actions.some((action) => action.status === "created" || action.status === "updated" || action.status === "stale");
|
|
4841
4849
|
return {
|
|
4842
4850
|
actions,
|
|
4843
4851
|
warnings: [...unmatchedWarnings(options.only), ...options.uninstall ? [] : [...untouchedWarnings(plans), ...budgetWarnings(plans)]],
|
|
@@ -7267,10 +7275,16 @@ warning ${warning}`);
|
|
|
7267
7275
|
}
|
|
7268
7276
|
if (!result.ok) {
|
|
7269
7277
|
const stale = result.actions.filter((action) => action.status === "created" || action.status === "updated").map((action) => action.path);
|
|
7270
|
-
|
|
7271
|
-
|
|
7278
|
+
if (stale.length > 0) {
|
|
7279
|
+
io.err(
|
|
7280
|
+
`
|
|
7272
7281
|
${stale.join(", ")} ${stale.length === 1 ? "is" : "are"} out of date. Run \`npx vitest-auto-spy init\` to update ${stale.length === 1 ? "it" : "them"}.`
|
|
7273
|
-
|
|
7282
|
+
);
|
|
7283
|
+
}
|
|
7284
|
+
for (const action of result.actions.filter((candidate) => candidate.status === "stale")) {
|
|
7285
|
+
io.err(`
|
|
7286
|
+
${action.path} is a stale copy of the shipped skill. Delete it, then run \`npx vitest-auto-spy init\`.`);
|
|
7287
|
+
}
|
|
7274
7288
|
return 1;
|
|
7275
7289
|
}
|
|
7276
7290
|
io.out(check ? "\nUp to date." : "\nDone. Re-run after upgrading the package; the block between the markers is regenerated.");
|
package/dist/console.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useVitestAdapter } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { useVitestAdapter } from './chunk-6JLBZHQ3.js';
|
|
2
|
+
import './chunk-JR55747M.js';
|
|
3
3
|
import './chunk-YHDBRBGU.js';
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
4
|
+
import './chunk-2QEM4WP7.js';
|
|
5
|
+
import './chunk-CLQUJX6E.js';
|
|
6
6
|
import './chunk-PC3FAZT3.js';
|
|
7
|
-
import { createFunctionSpy } from './chunk-
|
|
8
|
-
import './chunk-
|
|
7
|
+
import { createFunctionSpy } from './chunk-72H6HNDI.js';
|
|
8
|
+
import './chunk-XNXIHKVM.js';
|
|
9
9
|
import './chunk-M3NTXLZG.js';
|
|
10
|
-
import './chunk-
|
|
10
|
+
import './chunk-JOPCMFYN.js';
|
|
11
11
|
import './chunk-ENCEEH23.js';
|
|
12
12
|
import { getMockAdapter } from './shared-state.js';
|
|
13
13
|
|
package/dist/eslint-plugin.cjs
CHANGED
|
@@ -181,6 +181,9 @@ function enclosingFunction(node) {
|
|
|
181
181
|
|
|
182
182
|
// src/lib/eslint/bindings.ts
|
|
183
183
|
var PACKAGE = "vitest-auto-spy";
|
|
184
|
+
var CORE_ENTRIES = new Set(
|
|
185
|
+
["", "/bun", "/bun-angular", "/node", "/rstest", "/react", "/vue", "/svelte"].map((entry) => `${PACKAGE}${entry}`)
|
|
186
|
+
);
|
|
184
187
|
var IMPORT_DEFINITION = "ImportBinding";
|
|
185
188
|
function findBinding(scope, name) {
|
|
186
189
|
for (let current = scope; current; current = current.upper) {
|
|
@@ -225,12 +228,16 @@ function insertImport(fixer, node, module, clause) {
|
|
|
225
228
|
return fixer.insertTextBeforeRange([at, at], `import ${clause} from '${module}';
|
|
226
229
|
`);
|
|
227
230
|
}
|
|
231
|
+
function coreEntryOf(node) {
|
|
232
|
+
return importsOf(node).map((declaration) => String(declaration.source.value)).find((module) => CORE_ENTRIES.has(module)) ?? PACKAGE;
|
|
233
|
+
}
|
|
228
234
|
function namedImportFrom(node, module) {
|
|
229
235
|
const declarations = importsOf(node).filter((declaration) => declaration.source.value === module && declaration.importKind !== "type");
|
|
230
236
|
const [only] = declarations;
|
|
231
237
|
return declarations.length === 1 && only?.specifiers.every(isNamedImportSpecifier) === true ? only : void 0;
|
|
232
238
|
}
|
|
233
|
-
function importNamed(fixer, node, name,
|
|
239
|
+
function importNamed(fixer, node, name, requested) {
|
|
240
|
+
const module = requested === PACKAGE ? coreEntryOf(node) : requested;
|
|
234
241
|
const specifiers = namedImportFrom(node, module)?.specifiers.filter(isNamedImportSpecifier) ?? [];
|
|
235
242
|
const entries2 = specifiers.map((specifier) => ({
|
|
236
243
|
specifier,
|
|
@@ -1746,7 +1753,7 @@ function asSpyFixes(context, fixer, node, value, spy) {
|
|
|
1746
1753
|
const call = `asSpy${typeArguments ? sourceCode.getText(typeArguments) : ""}(${sourceCode.getText(value)})`;
|
|
1747
1754
|
const edits = [fixer.replaceText(node, call)];
|
|
1748
1755
|
if (bindingState(sourceCode.getScope(node), "asSpy") === "free") {
|
|
1749
|
-
edits.push(
|
|
1756
|
+
edits.push(importNamed(fixer, node, "asSpy", PACKAGE));
|
|
1750
1757
|
}
|
|
1751
1758
|
const orphaned = spy?.references.length === 1 ? dropNamedImport(sourceCode, fixer, spy) : void 0;
|
|
1752
1759
|
if (orphaned) {
|
|
@@ -2084,6 +2091,7 @@ var preferObserverStub = defineRule({
|
|
|
2084
2091
|
// src/lib/eslint/global-assignment.ts
|
|
2085
2092
|
var NETWORK_GLOBALS = /* @__PURE__ */ new Set(["EventSource", "WebSocket", "XMLHttpRequest", "fetch"]);
|
|
2086
2093
|
var WEB_STORAGES = /* @__PURE__ */ new Set(["localStorage", "sessionStorage"]);
|
|
2094
|
+
var WORKER_GLOBALS = /* @__PURE__ */ new Set(["Worker"]);
|
|
2087
2095
|
var TEARDOWN_HOOKS = /* @__PURE__ */ new Set(["afterAll", "afterEach", "onTestFinished"]);
|
|
2088
2096
|
var PER_TEST = /* @__PURE__ */ new Set(["beforeEach", "it", "test"]);
|
|
2089
2097
|
function insideTeardown(node) {
|
|
@@ -2114,6 +2122,9 @@ function messageFor(name) {
|
|
|
2114
2122
|
if (NETWORK_GLOBALS.has(name)) {
|
|
2115
2123
|
return "networkGlobal";
|
|
2116
2124
|
}
|
|
2125
|
+
if (WORKER_GLOBALS.has(name)) {
|
|
2126
|
+
return "workerGlobal";
|
|
2127
|
+
}
|
|
2117
2128
|
return WEB_STORAGES.has(name) ? "webStorage" : "handAssignedGlobal";
|
|
2118
2129
|
}
|
|
2119
2130
|
function globalFix(name) {
|
|
@@ -2192,6 +2203,7 @@ var noHandAssignedGlobal = defineRule({
|
|
|
2192
2203
|
messages: {
|
|
2193
2204
|
networkGlobal: "`{{name}}` is replaced by assignment and nothing puts the real one back, so under `isolate: false` the fake answers every later test in the worker. Install it with `{{fix}}`, which restores the original after the test.",
|
|
2194
2205
|
webStorage: "`{{name}}` is replaced by assignment and nothing puts the real one back, so the fake storage, and whatever the test wrote into it, leaks into every later test. Use `stubWebStorage('{{name}}')` from `vitest-auto-spy/dom-stubs`, which is restored after every test.",
|
|
2206
|
+
workerGlobal: "`{{name}}` is replaced by assignment and nothing puts the real one back, so under `isolate: false` every later test in the worker constructs the double. Use `stubWorker({ respond })` from `vitest-auto-spy/dom-stubs`, which is restored after every test.",
|
|
2195
2207
|
handAssignedGlobal: "`{{name}}` is replaced by assignment and nothing puts the real one back, so under `isolate: false` the double stays installed for every later test in the worker. Install it with `{{fix}}`, which restores the original after the test.",
|
|
2196
2208
|
importedMember: "`{{object}}.{{name}}` is written into an imported module, which stays cached for the worker, so the value answers later tests that never set it. Use `mockValueProp({{object}}, '{{name}}', value)`, which restores it after the test.",
|
|
2197
2209
|
restoreInTest: "`{{name}}` is replaced and put back by hand outside a teardown hook, so the first failing assertion before the restore leaves the double installed for every later test. Use `mockValueProp(globalThis, '{{name}}', value)`, whose undo runs in a hook, or move the restore into `afterEach`."
|
|
@@ -3506,7 +3518,6 @@ var noPrivateMemberAccess = defineRule({
|
|
|
3506
3518
|
});
|
|
3507
3519
|
|
|
3508
3520
|
// src/lib/eslint/prop-helpers.ts
|
|
3509
|
-
var PACKAGE2 = "vitest-auto-spy";
|
|
3510
3521
|
function helperFor(property) {
|
|
3511
3522
|
const name = propertyName(property);
|
|
3512
3523
|
if (name === "value") {
|
|
@@ -3542,7 +3553,7 @@ function propHelperSuggestion(context, node) {
|
|
|
3542
3553
|
fix: (fixer) => {
|
|
3543
3554
|
const edits = [fixer.replaceText(node, replacement)];
|
|
3544
3555
|
if (state === "free") {
|
|
3545
|
-
edits.push(
|
|
3556
|
+
edits.push(importNamed(fixer, node, rewrite2.helper, PACKAGE));
|
|
3546
3557
|
}
|
|
3547
3558
|
return edits;
|
|
3548
3559
|
}
|
|
@@ -4551,9 +4562,6 @@ var noRedundantSmokeTest = defineRule({
|
|
|
4551
4562
|
var FACTORY = "createSpyFromInstance";
|
|
4552
4563
|
var OWN = "spyOnOwnMethod";
|
|
4553
4564
|
var VOID = "spyOnVoidMethod";
|
|
4554
|
-
var CORE_ENTRIES = new Set(
|
|
4555
|
-
["", "/bun", "/bun-angular", "/node", "/rstest", "/react", "/vue", "/svelte"].map((entry) => `${PACKAGE}${entry}`)
|
|
4556
|
-
);
|
|
4557
4565
|
var METHOD_NAME = /^[$A-Z_a-z][\w$]*$/;
|
|
4558
4566
|
var EVENT_CONSTRUCTOR = /^[A-Za-z]*Event$/;
|
|
4559
4567
|
var DOM_GLOBALS = /* @__PURE__ */ new Set(["document", "window"]);
|
package/dist/jasmine-compat.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { enableJasmineCompat } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { enableJasmineCompat } from './chunk-LAPHUX5G.js';
|
|
2
|
+
import './chunk-JOPCMFYN.js';
|
|
3
3
|
import './chunk-ENCEEH23.js';
|
package/dist/jasmine.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { enableJasmineCompat } from './chunk-
|
|
2
|
-
export { enableJasmineCompat } from './chunk-
|
|
3
|
-
import { createSpyFromClass } from './chunk-
|
|
4
|
-
import { useVitestAdapter } from './chunk-
|
|
5
|
-
import './chunk-
|
|
1
|
+
import { enableJasmineCompat } from './chunk-LAPHUX5G.js';
|
|
2
|
+
export { enableJasmineCompat } from './chunk-LAPHUX5G.js';
|
|
3
|
+
import { createSpyFromClass } from './chunk-YDPOBKST.js';
|
|
4
|
+
import { useVitestAdapter } from './chunk-6JLBZHQ3.js';
|
|
5
|
+
import './chunk-JR55747M.js';
|
|
6
6
|
import './chunk-YHDBRBGU.js';
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
7
|
+
import './chunk-2QEM4WP7.js';
|
|
8
|
+
import './chunk-CLQUJX6E.js';
|
|
9
9
|
import './chunk-PC3FAZT3.js';
|
|
10
|
-
import { createFunctionSpy } from './chunk-
|
|
11
|
-
import { reportMisconfiguration, misconfigurationThrows } from './chunk-
|
|
10
|
+
import { createFunctionSpy } from './chunk-72H6HNDI.js';
|
|
11
|
+
import { reportMisconfiguration, misconfigurationThrows } from './chunk-XNXIHKVM.js';
|
|
12
12
|
import './chunk-M3NTXLZG.js';
|
|
13
|
-
import { jasmineGlobals, jasmineClock, jasmineAutoSpies, jasmineTimeout } from './chunk-
|
|
13
|
+
import { jasmineGlobals, jasmineClock, jasmineAutoSpies, jasmineTimeout } from './chunk-JOPCMFYN.js';
|
|
14
14
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
15
15
|
import { expect, vi } from 'vitest';
|
|
16
16
|
import { getMockAdapter } from './shared-state.js';
|
package/dist/nestjs.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { createSpyForToken } from './chunk-
|
|
2
|
-
export { trackInjections } from './chunk-
|
|
3
|
-
import { createSpyFromClass } from './chunk-
|
|
4
|
-
import { useVitestAdapter } from './chunk-
|
|
5
|
-
import './chunk-
|
|
1
|
+
import { createSpyForToken } from './chunk-7WM3A4IB.js';
|
|
2
|
+
export { trackInjections } from './chunk-7WM3A4IB.js';
|
|
3
|
+
import { createSpyFromClass } from './chunk-YDPOBKST.js';
|
|
4
|
+
import { useVitestAdapter } from './chunk-6JLBZHQ3.js';
|
|
5
|
+
import './chunk-JR55747M.js';
|
|
6
6
|
import './chunk-YHDBRBGU.js';
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
7
|
+
import './chunk-2QEM4WP7.js';
|
|
8
|
+
import './chunk-CLQUJX6E.js';
|
|
9
9
|
import './chunk-PC3FAZT3.js';
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
10
|
+
import './chunk-72H6HNDI.js';
|
|
11
|
+
import './chunk-XNXIHKVM.js';
|
|
12
12
|
import './chunk-M3NTXLZG.js';
|
|
13
|
-
import { nestUnitRefusals } from './chunk-
|
|
13
|
+
import { nestUnitRefusals } from './chunk-JOPCMFYN.js';
|
|
14
14
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
15
15
|
|
|
16
16
|
// src/lib/nestjs.ts
|
package/dist/rstest.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createLog, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectAllEmissions, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, outOfType, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, spyOnOwnMethod, spyOnVoidMethod, stubConstructor, withOverrides } from './chunk-
|
|
2
|
-
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-
|
|
3
|
-
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-
|
|
1
|
+
export { adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createLog, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectAllEmissions, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, outOfType, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, spyOnOwnMethod, spyOnVoidMethod, stubConstructor, withOverrides } from './chunk-TMFV4DXT.js';
|
|
2
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-6JQ7AFWM.js';
|
|
3
|
+
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-YDPOBKST.js';
|
|
4
4
|
import './chunk-W5EXSI22.js';
|
|
5
|
-
import { clearAllFastSpies, resetAllFastSpies, getSpyEngine, createFastSpy } from './chunk-
|
|
6
|
-
import { guardAccessorSpies, spyOnAccessorByRedefine } from './chunk-
|
|
7
|
-
import './chunk-
|
|
5
|
+
import { clearAllFastSpies, resetAllFastSpies, getSpyEngine, createFastSpy } from './chunk-JR55747M.js';
|
|
6
|
+
import { guardAccessorSpies, spyOnAccessorByRedefine } from './chunk-2QEM4WP7.js';
|
|
7
|
+
import './chunk-CLQUJX6E.js';
|
|
8
8
|
import './chunk-PC3FAZT3.js';
|
|
9
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
10
|
-
import './chunk-
|
|
9
|
+
export { createFunctionSpy, errorHandler } from './chunk-72H6HNDI.js';
|
|
10
|
+
import './chunk-XNXIHKVM.js';
|
|
11
11
|
import './chunk-M3NTXLZG.js';
|
|
12
|
-
import './chunk-
|
|
12
|
+
import './chunk-JOPCMFYN.js';
|
|
13
13
|
import './chunk-ENCEEH23.js';
|
|
14
14
|
import { rstest } from '@rstest/core';
|
|
15
15
|
import { registerMockAdapter } from './shared-state.js';
|
package/dist/rxjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { REPLAY_BUFFER_SIZE } from './chunk-YHDBRBGU.js';
|
|
2
|
-
import { decorate, attachHelpers, misconfigurationThrows, reportMisconfiguration, hooksOf, detachedHelperError } from './chunk-
|
|
3
|
-
import { nextWithValuesLate } from './chunk-
|
|
2
|
+
import { decorate, attachHelpers, misconfigurationThrows, reportMisconfiguration, hooksOf, detachedHelperError } from './chunk-XNXIHKVM.js';
|
|
3
|
+
import { nextWithValuesLate } from './chunk-JOPCMFYN.js';
|
|
4
4
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
5
5
|
import { defer, ReplaySubject, from, concatMap, of, delay, takeWhile, timer, switchMap, throwError, EMPTY, merge, takeUntil, take } from 'rxjs';
|
|
6
6
|
import { registerObservableSupport } from './shared-state.js';
|
package/dist/signal-forms.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { signalFormsErrors, signalFormsCreate } from './chunk-
|
|
1
|
+
import { signalFormsErrors, signalFormsCreate } from './chunk-JOPCMFYN.js';
|
|
2
2
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
3
3
|
import { Injector, isSignal, signal, ɵSIGNAL as _SIGNAL } from '@angular/core';
|
|
4
4
|
import { TestBed } from '@angular/core/testing';
|
|
@@ -201,19 +201,6 @@ interface AutoSpiedInstance<T> {
|
|
|
201
201
|
*/
|
|
202
202
|
declare function createWithAutoSpies<T>(target: Type<T>, options?: CreateWithAutoSpiesOptions): AutoSpiedInstance<T>;
|
|
203
203
|
|
|
204
|
-
/**
|
|
205
|
-
* `hostElement` / `queryElement` — a typed element out of a fixture, without a cast.
|
|
206
|
-
*
|
|
207
|
-
* Angular types `ComponentFixture.nativeElement` and `DebugElement.nativeElement` as `any`. Under
|
|
208
|
-
* `@typescript-eslint/strict-type-checked` every read of it is a `no-unsafe-*` report, and the one
|
|
209
|
-
* way to type it — `fixture.nativeElement as HTMLElement` — is exactly what
|
|
210
|
-
* `consistent-type-assertions: 'never'` forbids. A suite that turns both on has no clean route to
|
|
211
|
-
* its own DOM.
|
|
212
|
-
*
|
|
213
|
-
* These two check the element at run time with `instanceof` and return it typed, so the narrowing
|
|
214
|
-
* is a fact rather than a claim: a selector that matches nothing, or matches an element of another
|
|
215
|
-
* kind, fails at the call that asked, with the selector and what it found in the message.
|
|
216
|
-
*/
|
|
217
204
|
/** A `ComponentFixture` or a `DebugElement` — the only member read is `nativeElement`. */
|
|
218
205
|
interface NativeElementHolder {
|
|
219
206
|
readonly nativeElement: unknown;
|
|
@@ -230,7 +217,7 @@ type ElementConstructor<E extends Element> = abstract new (...args: never[]) =>
|
|
|
230
217
|
*
|
|
231
218
|
* @param source A `ComponentFixture` or a `DebugElement`.
|
|
232
219
|
* @param type The element type to check against and return; `HTMLElement` when omitted.
|
|
233
|
-
* @throws TypeError when `nativeElement` is not an element, or not an instance of `type`.
|
|
220
|
+
* @throws TypeError when `source` is null, `nativeElement` is not an element, or it is not an instance of `type`.
|
|
234
221
|
*/
|
|
235
222
|
declare function hostElement(source: NativeElementHolder): HTMLElement;
|
|
236
223
|
declare function hostElement<E extends Element>(source: NativeElementHolder, type: ElementConstructor<E>): E;
|
package/dist/zone.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-auto-spy",
|
|
3
|
-
"version": "5.32.
|
|
3
|
+
"version": "5.32.2",
|
|
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",
|
|
@@ -146,6 +146,9 @@ would have broken is reported as `codemod-broke-syntax` and left byte for byte a
|
|
|
146
146
|
specs are visited too. An unknown flag for a known command, and a path matching no file, are errors
|
|
147
147
|
with **exit 2** and nothing runs — `init --dryrun` used to write the files.
|
|
148
148
|
|
|
149
|
+
`init` lists a hand-made copy of this skill in `.claude/skills/vitest-auto-spy/` as `stale` and
|
|
150
|
+
`init --check` exits 1 on it: delete the copy and re-run `init`, which writes the managed pointer.
|
|
151
|
+
|
|
149
152
|
## Skeleton — anything else
|
|
150
153
|
|
|
151
154
|
```ts
|
|
@@ -280,6 +283,8 @@ it('loads', async () => {
|
|
|
280
283
|
| "did the migration lose a test?" with matching counters | `compareTestRuns(before, after)` — `counts` reports `name (×2 → ×1)` |
|
|
281
284
|
| an input that has to change after the first render | `await setInputs(fixture, { … })` — aliases and `hostDirectives` inputs resolve, unknown names refused |
|
|
282
285
|
| `fixture.nativeElement as HTMLElement`, or `no-unsafe-*` on `nativeElement` under a strict lint | `hostElement(fixture)` / `queryElement(fixture, '.close', HTMLButtonElement)` — typed and `instanceof`-checked; a miss throws naming the selector |
|
|
286
|
+
| `host.querySelector('.title')?.textContent.trim()` after `hostElement` | `queryElement(fixture, '.title').textContent.trim()` — a miss throws instead of passing as `undefined`; for absence keep `expect(host.querySelector('.x')).toBeNull()` |
|
|
287
|
+
| `Cannot read properties of null (reading 'nativeElement')` on a `debugElement.query(…)` | the query matched nothing — `hostElement` / `queryElement` now throw saying so; fix the predicate |
|
|
283
288
|
| `CalledExactlyOnceWith()` failing `[] vs [undefined]` on an `output<void>()` listener | the listener gets `undefined` — `await expect(expectEmission(cmp.closed)).resolves.toBeUndefined()`, or `subscribeSpyTo(subject$)` |
|
|
284
289
|
| `replaced the dispatch … after calledWith()` right after `mockReset()` | `mockReset()` keeps the chain — `resetAutoSpy(spy.method)`, then `mockReturnValue(…)` |
|
|
285
290
|
| `injectMatDialogRef(MatDialogRef<C, R>)` comes back `any` (`no-unsafe-assignment`) | `injectMatDialogRef<MatDialogRef<C, R>>(MatDialogRef)` — the instantiation expression is read off Material's `any` prototype |
|
|
@@ -534,7 +539,7 @@ from `vitest-auto-spy/angular-router` rather than at `provideAutoSpy`.
|
|
|
534
539
|
|
|
535
540
|
**`no-unasserted-argument` reports a bare `expect(spy).toHaveBeenCalled()` where the file itself says the arguments are the point** — either the same subject is pinned with `toHaveBeenCalledWith(…)` in another test of the file, or the test's title says `with` and its body asserts nothing but bare calls. Narrower than `vitest/prefer-called-with` on purpose: on one 2032-file suite that reports 1941 times in 360 files and this one 175 in 90. `not.toHaveBeenCalled()` and the counting matchers are never reported. `warn` rather than `error`, because the repair is the argument list the test should have named — `toHaveBeenCalledWith(…)`, `toHaveBeenCalledExactlyOnceWith(…)`, or `mustBeCalledWith(…)` where the double is configured — and that is the one thing the rule cannot write.
|
|
536
541
|
|
|
537
|
-
**`no-hand-assigned-global` reports a double assigned straight to a global** — `global.fetch = vi.fn(…)`, `window.matchMedia = vi.fn()`, `window.localStorage = { getItem: vi.fn() }` — unless the file puts it back in `afterEach` / `afterAll` / `onTestFinished`. Replace the assignment with `mockValueProp(globalThis, 'fetch', vi.fn(…))` (undone by `restoreMockedProps()`, which `setupAutoSpy()` runs), use `blockNetwork()` when the spec only has to stay offline,
|
|
542
|
+
**`no-hand-assigned-global` reports a double assigned straight to a global** — `global.fetch = vi.fn(…)`, `window.matchMedia = vi.fn()`, `window.localStorage = { getItem: vi.fn() }` — unless the file puts it back in `afterEach` / `afterAll` / `onTestFinished`. Replace the assignment with `mockValueProp(globalThis, 'fetch', vi.fn(…))` (undone by `restoreMockedProps()`, which `setupAutoSpy()` runs), use `blockNetwork()` when the spec only has to stay offline, `stubWebStorage('localStorage')` for the storages, and `stubWorker({ respond })` for `globalThis.Worker`. Do not "fix" it by adding a restore as the last line of the `it`: that form is reported too, because a red assertion skips it. The same rule reports any value written into an imported object — `environment.production = true` — and `--fix` rewrites it to `mockValueProp(environment, 'production', true)` inside a test or `beforeEach`.
|
|
538
543
|
|
|
539
544
|
**`registerAutoSpyDefaults(Class, config)` puts a spy's composition with the class, once.** Call it
|
|
540
545
|
from the setup file for a class every suite doubles the same way (`Router` with
|