vitest-auto-spy 5.38.0 → 5.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -1
- package/README.md +26 -25
- package/agent-docs/angular.md +22 -4
- package/agent-docs/checklist.md +4 -2
- package/agent-docs/configuration.md +3 -2
- package/agent-docs/doubles.md +4 -1
- package/agent-docs/return-helpers.md +7 -0
- package/agent-docs/setup.md +4 -1
- package/dist/angular-diagnostics.js +3 -3
- package/dist/angular-doubles.d.ts +1 -1
- package/dist/angular-matchers.js +25 -1
- package/dist/angular-router.d.ts +1 -1
- package/dist/angular.d.ts +7 -6
- package/dist/angular.js +2 -0
- package/dist/bun-angular.d.ts +5 -5
- package/dist/bun-angular.js +7 -7
- package/dist/bun.d.ts +8 -8
- package/dist/bun.js +3 -3
- package/dist/{chunk-2KBRDNIB.js → chunk-3UUM6YM5.js} +2 -2
- package/dist/{chunk-5TYNQH5Q.js → chunk-5D5GTU4A.js} +2 -2
- package/dist/{chunk-FWXDSPZD.js → chunk-RCUQDITG.js} +31 -9
- package/dist/{chunk-2TZCJ3MM.js → chunk-UH3YJSRP.js} +1 -1
- package/dist/{chunk-6KP5QMMV.js → chunk-Z7RCF47R.js} +14 -3
- package/dist/cli.js +27 -3
- package/dist/console.d.ts +1 -1
- package/dist/dom-stubs.d.ts +15 -3
- package/dist/dom-stubs.js +66 -17
- package/dist/{expect-emission-wUaoy0NW.d.ts → expect-emission-CwosjG6t.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +45 -12
- package/dist/jasmine-compat.d.ts +1 -1
- package/dist/jasmine.d.ts +2 -2
- package/dist/jasmine.js +1 -1
- package/dist/nestjs.d.ts +2 -2
- package/dist/nestjs.js +3 -3
- package/dist/node.cjs +45 -12
- package/dist/node.d.ts +4 -4
- package/dist/node.js +45 -12
- package/dist/{package-identity-5pFBRWW9.d.ts → package-identity-CBgwC1T6.d.ts} +1 -1
- package/dist/{prop-mock-8Ps9usRa.d.ts → prop-mock-C8PJ-Vo8.d.ts} +4 -3
- package/dist/react.d.ts +4 -4
- package/dist/rstest.d.ts +4 -4
- package/dist/rstest.js +3 -3
- package/dist/rxjs.d.ts +2 -2
- package/dist/setup.d.ts +3 -3
- package/dist/setup.js +28 -6
- package/dist/svelte.d.ts +4 -4
- package/dist/{track-injections-DyqkWQmT.d.ts → track-injections-Bp8TgLjG.d.ts} +1 -1
- package/dist/{track-signal-runs-C7SrW3Ub.d.ts → track-signal-runs-DUZUFWf-.d.ts} +3 -3
- package/dist/{types-BVKEkhWj.d.ts → types-DJ0OGc3C.d.ts} +3 -0
- package/dist/vue.d.ts +5 -5
- package/package.json +1 -1
- package/skills/vitest-auto-spy/SKILL.md +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,64 @@ The latest released version here must always match the one published on
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [5.40.0] - 2026-09-27
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **`stubAnimationFrame` gets `flushAll(timestamp?)`**, which runs frames until none is pending,
|
|
18
|
+
including those requested from inside a frame. Code whose callbacks chain through several frames
|
|
19
|
+
needed `while (frames.pending) frames.flush()` in the spec. It throws after 1000 rounds, which only a
|
|
20
|
+
loop that never stops requesting reaches.
|
|
21
|
+
`/dom-stubs` is +323 B min+gzip (8877 → 9200 B, +3.6 %) and +1.7 kB to import (53818 → 55476 B):
|
|
22
|
+
`flushAll`, the cancel forwarding, and the array-length snapshot in the `mockValueProp` it bundles.
|
|
23
|
+
- **`doctor` check `angular-build-splitting-deprecated`.** `@angular/build` 22.2.0 deprecates the
|
|
24
|
+
unit-test `splitting` option ("No longer needed with Vitest 5"). A target that still sets it is
|
|
25
|
+
reported: `info` for `true`, the default and a no-op, `warning` for `false`, which 22.2 still honours
|
|
26
|
+
at the memory cost `angular-build-splitting-off` describes. The setup docs now say not to add the key.
|
|
27
|
+
- **`SubjectOf` is exported from `vitest-auto-spy/angular`**, so an Angular spec can type the variable
|
|
28
|
+
that keeps what `returnSubject()` returned without a second import from the root entry. The
|
|
29
|
+
observables docs show `void spy.x$.returnSubject();` for the case where nothing reads it, which
|
|
30
|
+
`rxjs-x/no-floating-observables` accepts.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- **A class built on an ngrx `signalStore()` gets `fillMissing: true` by default** in
|
|
35
|
+
`createSpyFromClass` / `provideAutoSpy`. Its `withMethods` / `withProps` members live on the
|
|
36
|
+
instance, so discovery saw only what the class body declared: a store with an empty body took the
|
|
37
|
+
empty-prototype fallback and answered every member, while one method left in the body made every
|
|
38
|
+
store member absent, and `returns: { toggle: … }` failed with "not a method". The base ngrx
|
|
39
|
+
generates is recognised by name (`SignalStore`) and its own `ɵprov`. `fillMissing: false` turns it
|
|
40
|
+
off.
|
|
41
|
+
- **`stubAnimationFrame`'s `cancelAnimationFrame` passes a handle it did not issue on to the
|
|
42
|
+
`cancelAnimationFrame` it replaced.** Installed after a render, the stub received zoneless Angular's
|
|
43
|
+
cancel for the native frame its scheduler had raced against a timer, dropped it, and left that frame
|
|
44
|
+
pending: one leaked timer per test under a strict setup. Handles the stub issues now start at 2^30,
|
|
45
|
+
above the ids jsdom and happy-dom hand out.
|
|
46
|
+
- The recipes and the `prefer-render-shallow` docs show a per-test `renderShallow` whose `beforeCreate`
|
|
47
|
+
does the `injectSpy` reads and the test's own tuning, for a component that reads spies in its
|
|
48
|
+
constructor.
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- **`mockValueProp(array, 'length', n)` puts back the elements it truncated.** Shrinking `length`
|
|
53
|
+
deletes every element past it, and the undo wrote only the number back, so a shared constant came
|
|
54
|
+
back as an array of holes and every later test that read it failed. The truncated slots are copied
|
|
55
|
+
before the patch and restored with the length; holes stay holes.
|
|
56
|
+
|
|
57
|
+
## [5.39.0] - 2026-09-26
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
|
|
61
|
+
- **`toHaveDirectiveApplied` names the component under test in its failure.** On a fixture from
|
|
62
|
+
`TestBed.createComponent(Card)` it said the directive was on no element of the fixture and advised
|
|
63
|
+
`createDirectiveHost` — a host for a spec, not a fix for `Card`. It now says the directive is not on
|
|
64
|
+
`Card`'s host element or in its template, and to list it in `Card`'s `hostDirectives` or `imports`
|
|
65
|
+
(or, for a directive declared by an NgModule, that module in `Card`'s `imports`). A host built by
|
|
66
|
+
`createDirectiveHost` or by Angular 22.2's `TestBed.createDirective` still gets the
|
|
67
|
+
`createDirectiveHost` hint. `/angular/matchers` is +254 B min+gzip (1761 → 2015 B, +14.4 %) and
|
|
68
|
+
+1.3 kB to import (17594 → 18929 B): the second message and the host check; `createDirectiveHost`
|
|
69
|
+
itself is not pulled in — only its `Symbol.for` brand is shared.
|
|
70
|
+
|
|
13
71
|
## [5.38.0] - 2026-09-26
|
|
14
72
|
|
|
15
73
|
### Added
|
|
@@ -5483,7 +5541,9 @@ moved under 1 %: `/angular` +192 B (+1.0 %) for the override queue and the HTTP
|
|
|
5483
5541
|
This copy ships with the package and carries 5.x only. Releases before 5.0.0 are in the
|
|
5484
5542
|
[full changelog](https://github.com/ASDAlexey/vitest-auto-spy/blob/master/CHANGELOG.md).
|
|
5485
5543
|
|
|
5486
|
-
[Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.
|
|
5544
|
+
[Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.40.0...HEAD
|
|
5545
|
+
[5.40.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.39.0...v5.40.0
|
|
5546
|
+
[5.39.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.38.0...v5.39.0
|
|
5487
5547
|
[5.38.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.37.0...v5.38.0
|
|
5488
5548
|
[5.37.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.36.0...v5.37.0
|
|
5489
5549
|
[5.36.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.35.0...v5.36.0
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ faster at suite scale ([benchmarks](#benchmarks)) — and for
|
|
|
23
23
|
[](https://www.npmjs.com/package/vitest-auto-spy)
|
|
24
24
|
[](https://www.npmjs.com/package/vitest-auto-spy)
|
|
25
25
|
[](https://github.com/ASDAlexey/vitest-auto-spy/actions/workflows/ci.yml)
|
|
26
|
-
[](#install)
|
|
27
27
|
[](https://www.npmjs.com/package/vitest-auto-spy)
|
|
28
28
|
[](https://github.com/ASDAlexey/vitest-auto-spy/actions/workflows/ci.yml)
|
|
29
29
|
[](./LICENSE)
|
|
@@ -1035,30 +1035,31 @@ error tsconfig-glob-matches-nothing libs/users/tsconfig.spec.json
|
|
|
1035
1035
|
3 errors, 4 warnings, 1 note
|
|
1036
1036
|
```
|
|
1037
1037
|
|
|
1038
|
-
| Check
|
|
1039
|
-
|
|
|
1040
|
-
| `tsconfig-glob-matches-nothing`
|
|
1041
|
-
| `tsconfig-file-missing`
|
|
1042
|
-
| `spec-imported-by-non-spec`
|
|
1043
|
-
| `spec-exports-fixture`
|
|
1044
|
-
| `foreign-runner-pragma`
|
|
1045
|
-
| `dead-runner-config`
|
|
1046
|
-
| `orphan-runner-file`
|
|
1047
|
-
| `angular-build-splitting-off`
|
|
1048
|
-
| `
|
|
1049
|
-
| `
|
|
1050
|
-
| `coverage-
|
|
1051
|
-
| `coverage-include-
|
|
1052
|
-
| `
|
|
1053
|
-
| `vitest-5-
|
|
1054
|
-
| `vitest-5-
|
|
1055
|
-
| `
|
|
1056
|
-
| `
|
|
1057
|
-
| `
|
|
1058
|
-
| `
|
|
1059
|
-
| `
|
|
1060
|
-
| `
|
|
1061
|
-
| `
|
|
1038
|
+
| Check | What it finds |
|
|
1039
|
+
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1040
|
+
| `tsconfig-glob-matches-nothing` | An `include` pattern that matches no file — so it type-checks nothing; `info` when nothing beside the config is there to miss yet |
|
|
1041
|
+
| `tsconfig-file-missing` | A `files` entry naming a file that is gone |
|
|
1042
|
+
| `spec-imported-by-non-spec` | A production module importing a `*.spec.ts` |
|
|
1043
|
+
| `spec-exports-fixture` | A spec importing another spec, whose hooks then run in a foreign file |
|
|
1044
|
+
| `foreign-runner-pragma` | `@jest-environment` left in a spec, which Vitest never reads |
|
|
1045
|
+
| `dead-runner-config` | `jest.config.*` / `karma.conf.*` for a runner that is not installed |
|
|
1046
|
+
| `orphan-runner-file` | A setup file only that dead config referenced |
|
|
1047
|
+
| `angular-build-splitting-off` | `@angular/build` in `[22.1.5, 22.1.7)` — the OOM under `--coverage` |
|
|
1048
|
+
| `angular-build-splitting-deprecated` | `"splitting"` on a unit-test target under `@angular/build` 22.2+, which deprecates it — `true` is a no-op, `false` still costs the memory |
|
|
1049
|
+
| `analog-behind-angular-build` | `@analogjs/vite-plugin-angular` below 2.7.5 next to `@angular/build` 22.2+ — `TypeError: cache.has is not a function` at startup |
|
|
1050
|
+
| `coverage-all-removed` | `coverage.all` in a config, on a Vitest that stopped reading the key |
|
|
1051
|
+
| `coverage-include-misses-bundle` | A `coverage.include` of sources only, in a runner config over a bundle |
|
|
1052
|
+
| `coverage-include-recompiles-globs` | A coverage scope large enough that `picomatch` recompiling it per file costs more than the coverage. Info |
|
|
1053
|
+
| `vitest-5-removed` | What Vitest 5 removed — `vitest/reporters`-style imports, `.sequential`, `--outputJson`/`--compare`; error on 5, note on 4. Also `poolOptions` (warning, ignored since 4) |
|
|
1054
|
+
| `vitest-5-deprecated` | `experimental_clearCache` / `experimental_parseSpecifications` on Vitest 5, which nothing warns about at run time. Info |
|
|
1055
|
+
| `vitest-5-clear-mocks` | `clearMocks: true` restating the Vitest 5 default, or a Vitest 4 suite that never decided and will have mocks cleared after the upgrade. Info |
|
|
1056
|
+
| `mock-reset-config-unread` | `no-redundant-mock-reset` given a `configFile` whose default export is a factory or `mergeConfig` call and no flag beside it — the rule reads none of the flags that call sets. Info |
|
|
1057
|
+
| `vitest-5-available` | Vitest 4 with nothing holding back 5 — what it buys (−46 % v8 / −35.5 % istanbul on a 700-file Angular suite with coverage) — or what holds it back. Info |
|
|
1058
|
+
| `fs-module-cache-not-persisted` | `fsModuleCache` on, and no CI config caches its directory — every CI run starts cold |
|
|
1059
|
+
| `jasmine-era-project` | `jasmine-core`, `@types/jasmine`, `karma.conf.*` or `@hirez_io/observer-spy` still installed. Info, not an error |
|
|
1060
|
+
| `no-agent-instructions` | No instruction file names the package. A note, not an error |
|
|
1061
|
+
| `helper-from-wrong-entry` | A named import taken from an entry that does not export it — `provideAutoSpy` from the root |
|
|
1062
|
+
| `no-unawaited-helper` | An `expectEmission` / `stable` / `flushEventLoop` call dropped as a bare statement, so nothing awaits it |
|
|
1062
1063
|
|
|
1063
1064
|
The check that motivated the tool: a spec showing `Cannot find name 'vi'` in the editor while
|
|
1064
1065
|
`tsc --noEmit` reported zero errors. A migration codemod editing `include` had eaten a `/**`,
|
package/agent-docs/angular.md
CHANGED
|
@@ -945,9 +945,11 @@ the code does read the ref (it calls `destroy`), seed one from the method's own
|
|
|
945
945
|
export `RxMethodRef`: `returns: { load: createAutoMock<ReturnType<Store['load']>>() }`.
|
|
946
946
|
|
|
947
947
|
A `signalStore()` class keeps its methods and `rxMethod`s on the instance, not the prototype, so
|
|
948
|
-
discovery finds none of them.
|
|
949
|
-
|
|
950
|
-
|
|
948
|
+
discovery finds none of them. A class whose chain reaches the `SignalStore` base ngrx generates gets
|
|
949
|
+
`fillMissing: true` by default, so `provideAutoSpy(Store, { returns: { … } })` answers every such
|
|
950
|
+
member with a spy — `returns` and `strict` apply to them as to any method — whether or not the class
|
|
951
|
+
body still declares methods of its own; no `instanceMethodsToSpyOn` list, no `fillMissing` to write.
|
|
952
|
+
`fillMissing: false` turns it off for one store.
|
|
951
953
|
|
|
952
954
|
```ts
|
|
953
955
|
// shallow rendering — configureTestingModule + NO_ERRORS_SCHEMA + overrideComponent, in one call
|
|
@@ -959,6 +961,20 @@ const { fixture, component } = renderShallow(TaskListComponent, {
|
|
|
959
961
|
// COVERAGE: the override recompiles the component under JIT for the rest of the file (keepTemplate too),
|
|
960
962
|
// so its AOT template/host branches leave coverage — keep one real TestBed render first where they matter
|
|
961
963
|
|
|
964
|
+
// the component reads spies in its constructor and each test tunes them first: render per test, and
|
|
965
|
+
// do the injectSpy() reads plus the tuning in beforeCreate — after configure, before the constructor
|
|
966
|
+
const render = (tune: () => void = () => undefined) =>
|
|
967
|
+
renderShallow(SlidesComponent, {
|
|
968
|
+
providers: [provideAutoSpy(StateService)],
|
|
969
|
+
detectChanges: false,
|
|
970
|
+
beforeCreate: () => {
|
|
971
|
+
state = injectSpy(StateService);
|
|
972
|
+
state.savedUi.mockReturnValue(DEFAULT_UI); // the defaults beforeEach used to set
|
|
973
|
+
tune();
|
|
974
|
+
},
|
|
975
|
+
});
|
|
976
|
+
const { component } = render(() => state.savedUi.mockReturnValue(COLLAPSED_UI));
|
|
977
|
+
|
|
962
978
|
// change an input after the first render — one setInput per key, then the wait, in one await
|
|
963
979
|
await setInputs(fixture, { projectId: 7 }); // a name the component does not declare is refused here
|
|
964
980
|
await setInputs(fixture, { projectId: 7 }, { label: 'the task list' }); // options go to stable()
|
|
@@ -1189,7 +1205,9 @@ schemas apply to a testing module's `declarations` only.
|
|
|
1189
1205
|
It is also the guard for an attribute a `hostDirectives` entry puts on the component under test. An
|
|
1190
1206
|
assertion on the attribute alone stays green when the entry is dropped and the attribute is also
|
|
1191
1207
|
written statically, or set by something else; the fixture's root element is searched, so the entry
|
|
1192
|
-
itself can be asserted with no selector
|
|
1208
|
+
itself can be asserted with no selector. On a fixture of the component under test the failure names
|
|
1209
|
+
that component's `hostDirectives` / `imports` as the fix; only a spec-built host (`createDirectiveHost`,
|
|
1210
|
+
`TestBed.createDirective`) is pointed at `createDirectiveHost`:
|
|
1193
1211
|
|
|
1194
1212
|
```ts
|
|
1195
1213
|
import { registerDirectiveMatchers } from 'vitest-auto-spy/angular/matchers';
|
package/agent-docs/checklist.md
CHANGED
|
@@ -31,8 +31,10 @@ file an Angular or Nx unit-test target never runs because the target does not na
|
|
|
31
31
|
its checks are about coverage, where the run is green and the report is simply not the one the
|
|
32
32
|
config describes — `coverage.all` on a Vitest that stopped reading the key, a source-only
|
|
33
33
|
`coverage.include` in a runner config over a bundle, and a scope so large that `picomatch`
|
|
34
|
-
recompiling it per file costs more than collecting the coverage does.
|
|
35
|
-
builder's version: `@angular/build` in `[22.1.5, 22.1.7)` (`angular-build-splitting-off`),
|
|
34
|
+
recompiling it per file costs more than collecting the coverage does. Three are about the Angular
|
|
35
|
+
builder's version: `@angular/build` in `[22.1.5, 22.1.7)` (`angular-build-splitting-off`), a
|
|
36
|
+
`"splitting"` key on a unit-test target under 22.2 or newer, which deprecates it
|
|
37
|
+
(`angular-build-splitting-deprecated`: `info` for `true`, the default, `warning` for `false`), and an
|
|
36
38
|
`@analogjs/vite-plugin-angular` below 2.7.5 next to `@angular/build` 22.2 or newer
|
|
37
39
|
(`analog-behind-angular-build`), which dies at startup with `TypeError: cache.has is not a function`.
|
|
38
40
|
Five are about Vitest 5. On Vitest 5, `vitest-5-removed` reports what it took away and the run now
|
|
@@ -64,8 +64,9 @@ _something_, and that something would be truthy: `if (service.optionalThing)` in
|
|
|
64
64
|
would then take the wrong branch, silently, which is the exact failure mode the protocol deny-list
|
|
65
65
|
in §2 exists to remove. A loud `TypeError` on the spec's own line is the better of the two.
|
|
66
66
|
|
|
67
|
-
For an ngrx `signalStore()
|
|
68
|
-
|
|
67
|
+
For an ngrx `signalStore()` class, list nothing: a class built on the `SignalStore` base ngrx
|
|
68
|
+
generates gets `fillMissing: true` by default, so every instance member answers with a spy.
|
|
69
|
+
`createAutoMock<T>()` stays the answer when there is no class to hand. Its **signal** members want
|
|
69
70
|
`mockSignalProp`, not a method spy — a store's state is read during the first render, so a method spy
|
|
70
71
|
there answers `undefined` to the template.
|
|
71
72
|
|
package/agent-docs/doubles.md
CHANGED
|
@@ -153,7 +153,10 @@ it('scrolls after the next frame', () => {
|
|
|
153
153
|
`stubAnimationFrame` stubs `cancelAnimationFrame` too, and hands both spies back as
|
|
154
154
|
`frames.requestAnimationFrame` / `frames.cancelAnimationFrame`. A frame requested from inside a
|
|
155
155
|
running frame is queued in either mode, so a loop that requests its own next frame advances one step
|
|
156
|
-
per `flush()
|
|
156
|
+
per `flush()`; `frames.flushAll()` runs such a chain until nothing is pending (and throws after 1000
|
|
157
|
+
rounds, on a loop that never stops). A `cancelAnimationFrame` for a handle the stub did not issue — a
|
|
158
|
+
native frame requested before it was installed, such as zoneless Angular's scheduler frame — is
|
|
159
|
+
passed on to the real `cancelAnimationFrame`, so installing the stub after the render leaks no timer. A callback that throws stops `flush()` (or propagates out of `requestAnimationFrame`
|
|
157
160
|
in `'immediate'` mode); pass `onError: (error) => { … }` to intercept it instead — rethrow from
|
|
158
161
|
inside to keep the default for an error you did not mean to swallow. `stubElementRect` returns a real
|
|
159
162
|
`DOMRect` per call, edges derived, plus the installed spy as `.getBoundingClientRect` for
|
|
@@ -41,6 +41,13 @@ files (angular-cli#34134), so put the import in one of those. That is the _only_
|
|
|
41
41
|
`import { Observable, Subject } from 'rxjs'` and load 189 rxjs `.d.ts` files into every consumer's
|
|
42
42
|
program (303 files against 114 without it), `import type` included — TypeScript resolves a type-only import the same way.
|
|
43
43
|
|
|
44
|
+
Called only to open the stream — a strict double whose prop must be configured before the code
|
|
45
|
+
subscribes — `spy.items$.returnSubject();` as a bare statement trips `rxjs-x/no-floating-observables`:
|
|
46
|
+
the Subject it returns is dropped. Keep it when the spec pushes through it later, typed
|
|
47
|
+
`let items$: SubjectOf<Item[]>` (exported by the root entry and by `/angular`), or write
|
|
48
|
+
`void spy.items$.returnSubject();` when it never does — the rule's default `ignoreVoid: true` accepts
|
|
49
|
+
that.
|
|
50
|
+
|
|
44
51
|
```ts
|
|
45
52
|
// argument dispatch — other arguments return undefined
|
|
46
53
|
users.getName.calledWith(1).mockReturnValue('Ada');
|
package/agent-docs/setup.md
CHANGED
|
@@ -453,7 +453,10 @@ directory. That read is the one place the library touches the disk — one file,
|
|
|
453
453
|
`process.getBuiltinModule` so `/setup` still loads with no `process` — and `scripts/check-dist.mjs`
|
|
454
454
|
allows `node:fs` in `dist/setup.js` for exactly that. Silent outside the builder, outside the
|
|
455
455
|
window, and on a Node before `getBuiltinModule`. `setupAutoSpy({ angularBuildHint: false })` turns
|
|
456
|
-
it off.
|
|
456
|
+
it off. Outside the window there is nothing to set: from 22.1.7 splitting is on by default, and
|
|
457
|
+
22.2.0 deprecates the `splitting` option ("No longer needed with Vitest 5") — do not add
|
|
458
|
+
`"splitting": true`, and remove one that is there (`doctor` reports it as
|
|
459
|
+
`angular-build-splitting-deprecated`).
|
|
457
460
|
|
|
458
461
|
**Strict for one run:** `VITEST_AUTO_SPY_STRICT=1 npx vitest run <slice>` makes `setupAutoSpy()` arm
|
|
459
462
|
`strict` whatever the setup file passed (`0` turns it off, `survey` counts instead of throwing); a second `setupAutoSpy()` in an extra setup
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { pendingRequestsReport, assertAngularInternals, instrumentTestBed, onTestingModuleConfigured, onComponentCreated, beforeTestBedReset, verifyOnTeardown } from './chunk-GKSVYPZQ.js';
|
|
2
2
|
export { disableTestBedDiagnostics, enableTestBedDiagnostics, formatSpecTiming, getTestBedTiming, instrumentTestBed, reportSpecTiming } from './chunk-GKSVYPZQ.js';
|
|
3
|
-
import { failOnUnspiedProvider } from './chunk-
|
|
3
|
+
import { failOnUnspiedProvider } from './chunk-3UUM6YM5.js';
|
|
4
4
|
import './chunk-GG7BQKEK.js';
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
5
|
+
import './chunk-RCUQDITG.js';
|
|
6
|
+
import './chunk-Z7RCF47R.js';
|
|
7
7
|
import './chunk-FOL5RH22.js';
|
|
8
8
|
import './chunk-PC3FAZT3.js';
|
|
9
9
|
import './chunk-RYFF55PV.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InjectionToken, AbstractType, Injector, ValueProvider, FactoryProvider, ProviderToken } from '@angular/core';
|
|
2
|
-
import { h as AddSpyMethodsByReturnTypes } from './types-
|
|
2
|
+
import { h as AddSpyMethodsByReturnTypes } from './types-DJ0OGc3C.js';
|
|
3
3
|
import 'vitest';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/angular-matchers.js
CHANGED
|
@@ -2,10 +2,13 @@ import { count } from './chunk-M3NTXLZG.js';
|
|
|
2
2
|
import { angularDirectiveApplied } from './chunk-5FQZGJLJ.js';
|
|
3
3
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
4
4
|
import '@angular/compiler';
|
|
5
|
-
import { ɵSIGNAL as _SIGNAL, isStandalone } from '@angular/core';
|
|
5
|
+
import { ɵSIGNAL as _SIGNAL, isStandalone, reflectComponentType } from '@angular/core';
|
|
6
6
|
import { By } from '@angular/platform-browser';
|
|
7
7
|
import { expect } from 'vitest';
|
|
8
8
|
|
|
9
|
+
var DIRECTIVE_HOST = /* @__PURE__ */ Symbol.for("vitest-auto-spy.directive-host");
|
|
10
|
+
|
|
11
|
+
// src/lib/directive-matchers.ts
|
|
9
12
|
function rootOf(received) {
|
|
10
13
|
if (typeof received !== "object" || received === null) {
|
|
11
14
|
return void 0;
|
|
@@ -20,6 +23,18 @@ function rootOf(received) {
|
|
|
20
23
|
function matching(root, predicate) {
|
|
21
24
|
return predicate(root) ? [root, ...root.queryAll(predicate)] : root.queryAll(predicate);
|
|
22
25
|
}
|
|
26
|
+
function isClass(value) {
|
|
27
|
+
return typeof value === "function";
|
|
28
|
+
}
|
|
29
|
+
var TESTBED_DIRECTIVE_HOST = "ng-directive-test-component";
|
|
30
|
+
function componentUnderTest(root) {
|
|
31
|
+
const type = Reflect.get(Object(root.componentInstance), "constructor");
|
|
32
|
+
if (!isClass(type) || !root.providerTokens.includes(type) || Reflect.get(type, DIRECTIVE_HOST) === true) {
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
const mirror = reflectComponentType(type);
|
|
36
|
+
return mirror === null || mirror.selector.includes(TESTBED_DIRECTIVE_HOST) ? void 0 : type.name;
|
|
37
|
+
}
|
|
23
38
|
function diagnose(directive, selector, root) {
|
|
24
39
|
const elements = selector === void 0 ? [] : matching(root, By.css(selector));
|
|
25
40
|
const where = selector === void 0 ? "" : ` on '${selector}'`;
|
|
@@ -31,6 +46,15 @@ Run fixture.detectChanges() before asserting, and check the selector against the
|
|
|
31
46
|
angularDirectiveApplied
|
|
32
47
|
);
|
|
33
48
|
}
|
|
49
|
+
const component = componentUnderTest(root);
|
|
50
|
+
if (component !== void 0) {
|
|
51
|
+
const scope = isStandalone(directive) ? `list ${directive.name} in ${component}'s hostDirectives if the component should carry it, or in its imports if its template uses it` : `add the NgModule that declares ${directive.name} to ${component}'s imports if its template uses it`;
|
|
52
|
+
return withDocs(
|
|
53
|
+
`${prefix}, but it is not on ${component}'s host element or in its template.
|
|
54
|
+
To apply it, ${scope}.`,
|
|
55
|
+
angularDirectiveApplied
|
|
56
|
+
);
|
|
57
|
+
}
|
|
34
58
|
const cause = isStandalone(directive) ? `${directive.name} is standalone, so only the host component's own imports put it in scope` : `${directive.name} is declared by an NgModule, and a test bundle drops that module's scope, so importing it contributes nothing`;
|
|
35
59
|
return withDocs(
|
|
36
60
|
`${prefix}, but it is not on any element of this fixture \u2014 ${cause}.
|
package/dist/angular-router.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Type, Injector, FactoryProvider, Provider } from '@angular/core';
|
|
2
2
|
import { Params, Data, UrlSegment, ActivatedRoute, Route, ResolveData, Navigation, Router, Event } from '@angular/router';
|
|
3
|
-
import { h as AddSpyMethodsByReturnTypes } from './types-
|
|
3
|
+
import { h as AddSpyMethodsByReturnTypes } from './types-DJ0OGc3C.js';
|
|
4
4
|
import { SpyLocation } from '@angular/common/testing';
|
|
5
5
|
import 'vitest';
|
|
6
6
|
|
package/dist/angular.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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-
|
|
2
|
-
import { o as DeepPartial, C as ClassType, m as ClassSpyConfiguration, S as Spy, s as OnlyMethodKeysOf, h as AddSpyMethodsByReturnTypes, r as NotAPublicKey } from './types-
|
|
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-DUZUFWf-.js';
|
|
2
|
+
import { o as DeepPartial, C as ClassType, m as ClassSpyConfiguration, S as Spy, s as OnlyMethodKeysOf, h as AddSpyMethodsByReturnTypes, r as NotAPublicKey } from './types-DJ0OGc3C.js';
|
|
3
|
+
export { H as SubjectOf } from './types-DJ0OGc3C.js';
|
|
3
4
|
import { InjectionToken, Provider, Type, WritableSignal, Signal } from '@angular/core';
|
|
4
|
-
import { A as AutoMockConfiguration, D as DeepReadonly } from './expect-emission-
|
|
5
|
-
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-
|
|
5
|
+
import { A as AutoMockConfiguration, D as DeepReadonly } from './expect-emission-CwosjG6t.js';
|
|
6
|
+
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-CwosjG6t.js';
|
|
6
7
|
import { TestAPI } from 'vitest';
|
|
7
|
-
export { I as InjectionLog, T as TrackInjectionsOptions, a as TrackedProvider, t as trackInjections } from './track-injections-
|
|
8
|
-
export { A as AccessorImplementations, R as RestoreProp, c as countMockedProps, m as mockAccessorsProp, a as mockReadonlyProp, b as mockReadonlyPropGetter, d as mockValueProp, e as restoreMockedProps } from './prop-mock-
|
|
8
|
+
export { I as InjectionLog, T as TrackInjectionsOptions, a as TrackedProvider, t as trackInjections } from './track-injections-Bp8TgLjG.js';
|
|
9
|
+
export { A as AccessorImplementations, R as RestoreProp, c as countMockedProps, m as mockAccessorsProp, a as mockReadonlyProp, b as mockReadonlyPropGetter, d as mockValueProp, e as restoreMockedProps } from './prop-mock-C8PJ-Vo8.js';
|
|
9
10
|
import '@angular/core/testing';
|
|
10
11
|
|
|
11
12
|
/**
|
package/dist/angular.js
CHANGED
|
@@ -498,6 +498,7 @@ function setupAngularTestEnv(options) {
|
|
|
498
498
|
Reflect.set(globalThis, INSTALLED, installAngularTestEnv(options, readInstalledMode()));
|
|
499
499
|
});
|
|
500
500
|
}
|
|
501
|
+
var DIRECTIVE_HOST = /* @__PURE__ */ Symbol.for("vitest-auto-spy.directive-host");
|
|
501
502
|
function createDirectiveHost(options) {
|
|
502
503
|
const props = options.props ?? {};
|
|
503
504
|
class DirectiveHost {
|
|
@@ -514,6 +515,7 @@ function createDirectiveHost(options) {
|
|
|
514
515
|
imports: [...options.scope ?? []],
|
|
515
516
|
template: options.template
|
|
516
517
|
});
|
|
518
|
+
Reflect.set(DirectiveHost, DIRECTIVE_HOST, true);
|
|
517
519
|
return decorate(DirectiveHost);
|
|
518
520
|
}
|
|
519
521
|
function angularInternalsError(what, consequence) {
|
package/dist/bun-angular.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { A as AccessorKeysOf, a as AddAccessorsSpies, b as AddCalledWithAny, c as AddCalledWithObservable, d as AddCalledWithPromise, e as AddCalledWithSpyMethods, f as AddObservableSpyMethods, g as AddPromiseSpyMethods, h as AddSpyMethodsByReturnTypes, i as AddThrowHelper, j as AddVoidReturnHelpers, k as AnyReturnHelpers, l as AutoSpyRxjsTypes, m as ClassSpyConfiguration, C as ClassType, n as CompleteValueConfig, D as DeepMockProxy, o as DeepPartial, E as ErrorValueConfig, F as Func, p as FunctionSpy, I as InstanceSpyConfiguration, M as MethodReturns, q as Mutable, N as NextValueConfig, r as NotAPublicKey, O as ObservableLike, s as OnlyMethodKeysOf, t as OnlyObservablePropsOf, u as OnlyPropsOf, v as Overload, w as OverloadChoice, x as Overloads, P as PropStubValue, S as Spy, y as SpyDisposable, z as SpyOptions, B as StrictSpyConfiguration, G as SubjectLike, H as SubjectOf, U as UnstubbedCall, J as UnstubbedCallHandler, K as UnstubbedRead, L as UnstubbedReadHandler, V as ValueConfig, Q as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { A as AccessorKeysOf, a as AddAccessorsSpies, b as AddCalledWithAny, c as AddCalledWithObservable, d as AddCalledWithPromise, e as AddCalledWithSpyMethods, f as AddObservableSpyMethods, g as AddPromiseSpyMethods, h as AddSpyMethodsByReturnTypes, i as AddThrowHelper, j as AddVoidReturnHelpers, k as AnyReturnHelpers, l as AutoSpyRxjsTypes, m as ClassSpyConfiguration, C as ClassType, n as CompleteValueConfig, D as DeepMockProxy, o as DeepPartial, E as ErrorValueConfig, F as Func, p as FunctionSpy, I as InstanceSpyConfiguration, M as MethodReturns, q as Mutable, N as NextValueConfig, r as NotAPublicKey, O as ObservableLike, s as OnlyMethodKeysOf, t as OnlyObservablePropsOf, u as OnlyPropsOf, v as Overload, w as OverloadChoice, x as Overloads, P as PropStubValue, S as Spy, y as SpyDisposable, z as SpyOptions, B as StrictSpyConfiguration, G as SubjectLike, H as SubjectOf, U as UnstubbedCall, J as UnstubbedCallHandler, K as UnstubbedRead, L as UnstubbedReadHandler, V as ValueConfig, Q as ValueConfigPerCall, W as WithMockReturnValue } from './types-DJ0OGc3C.js';
|
|
2
2
|
export { AdoptMockOptions, AdoptedMock, ArgCaptor, AsInstances, AssertMockedOptions, CallLog, CaptureArgOptions, ConstructorMock, ConstructorSpy, FixtureFactory, FlushUntilOptions, MockDeepOptions, ModuleNamespace, ModuleNamespaceOptions, SpyClassOptions, adoptMock, asInstance, asInstances, asSpy, assertMocked, captureArg, clearAutoSpy, createFixture, createFixtureFactory, createLog, createMock, createSpyClass, createSpyFromClass, createSpyFromInstance, errorHandler, flushEventLoop, flushEventLoopUntil, mockConstructor, mockDeep, moduleNamespace, narrow, outOfType, resetAutoSpy, restoreSpiedInstance, settleDynamicImport, spyOnOwnMethod, spyOnVoidMethod, stubConstructor, withOverrides } from './bun.js';
|
|
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-
|
|
4
|
-
export { c as createFunctionSpy, d as describeDuplicateCopies, g as getPackageCopies } from './package-identity-
|
|
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-
|
|
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-
|
|
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-CwosjG6t.js';
|
|
4
|
+
export { c as createFunctionSpy, d as describeDuplicateCopies, g as getPackageCopies } from './package-identity-CBgwC1T6.js';
|
|
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-C8PJ-Vo8.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-DUZUFWf-.js';
|
|
7
7
|
import 'vitest';
|
|
8
8
|
import '@angular/core';
|
|
9
9
|
import '@angular/core/testing';
|
package/dist/bun-angular.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { createSpyForToken } from './chunk-
|
|
2
|
-
export { injectSpy, provideAutoSpy } from './chunk-
|
|
1
|
+
import { createSpyForToken } from './chunk-UH3YJSRP.js';
|
|
2
|
+
export { injectSpy, provideAutoSpy } from './chunk-3UUM6YM5.js';
|
|
3
3
|
import { stable, flushEffects } from './chunk-DBC6526L.js';
|
|
4
4
|
export { flushEffects, stable } from './chunk-DBC6526L.js';
|
|
5
5
|
import { angularInternalsError } from './chunk-GG7BQKEK.js';
|
|
6
6
|
import './chunk-QDBRZQJO.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-
|
|
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-
|
|
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-5D5GTU4A.js';
|
|
8
|
+
import { mockValueProp } from './chunk-RCUQDITG.js';
|
|
9
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-RCUQDITG.js';
|
|
10
|
+
import { closestName } from './chunk-Z7RCF47R.js';
|
|
11
|
+
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-Z7RCF47R.js';
|
|
12
12
|
import { fakeClockBacklog } from './chunk-W5EXSI22.js';
|
|
13
13
|
import './chunk-TXDBDMIL.js';
|
|
14
14
|
import './chunk-FOL5RH22.js';
|
package/dist/bun.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { z as SpyOptions, C as ClassType, m as ClassSpyConfiguration, s as OnlyMethodKeysOf, S as Spy, I as InstanceSpyConfiguration, o as DeepPartial, D as DeepMockProxy, F as Func, h as AddSpyMethodsByReturnTypes } from './types-
|
|
2
|
-
export { A as AccessorKeysOf, a as AddAccessorsSpies, b as AddCalledWithAny, c as AddCalledWithObservable, d as AddCalledWithPromise, e as AddCalledWithSpyMethods, f as AddObservableSpyMethods, g as AddPromiseSpyMethods, i as AddThrowHelper, j as AddVoidReturnHelpers, k as AnyReturnHelpers, l as AutoSpyRxjsTypes, n as CompleteValueConfig, E as ErrorValueConfig, p as FunctionSpy, M as MethodReturns, q as Mutable, N as NextValueConfig, r as NotAPublicKey, O as ObservableLike, t as OnlyObservablePropsOf, u as OnlyPropsOf, v as Overload, w as OverloadChoice, x as Overloads, P as PropStubValue, y as SpyDisposable, B as StrictSpyConfiguration, G as SubjectLike, H as SubjectOf, U as UnstubbedCall, J as UnstubbedCallHandler, K as UnstubbedRead, L as UnstubbedReadHandler, V as ValueConfig, Q as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
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-
|
|
4
|
-
export { c as createFunctionSpy, d as describeDuplicateCopies, g as getPackageCopies } from './package-identity-
|
|
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-
|
|
1
|
+
import { z as SpyOptions, C as ClassType, m as ClassSpyConfiguration, s as OnlyMethodKeysOf, S as Spy, I as InstanceSpyConfiguration, o as DeepPartial, D as DeepMockProxy, F as Func, h as AddSpyMethodsByReturnTypes } from './types-DJ0OGc3C.js';
|
|
2
|
+
export { A as AccessorKeysOf, a as AddAccessorsSpies, b as AddCalledWithAny, c as AddCalledWithObservable, d as AddCalledWithPromise, e as AddCalledWithSpyMethods, f as AddObservableSpyMethods, g as AddPromiseSpyMethods, i as AddThrowHelper, j as AddVoidReturnHelpers, k as AnyReturnHelpers, l as AutoSpyRxjsTypes, n as CompleteValueConfig, E as ErrorValueConfig, p as FunctionSpy, M as MethodReturns, q as Mutable, N as NextValueConfig, r as NotAPublicKey, O as ObservableLike, t as OnlyObservablePropsOf, u as OnlyPropsOf, v as Overload, w as OverloadChoice, x as Overloads, P as PropStubValue, y as SpyDisposable, B as StrictSpyConfiguration, G as SubjectLike, H as SubjectOf, U as UnstubbedCall, J as UnstubbedCallHandler, K as UnstubbedRead, L as UnstubbedReadHandler, V as ValueConfig, Q as ValueConfigPerCall, W as WithMockReturnValue } from './types-DJ0OGc3C.js';
|
|
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-CwosjG6t.js';
|
|
4
|
+
export { c as createFunctionSpy, d as describeDuplicateCopies, g as getPackageCopies } from './package-identity-CBgwC1T6.js';
|
|
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-C8PJ-Vo8.js';
|
|
6
6
|
import { Mock, MockInstance } from 'vitest';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -24,9 +24,9 @@ import { Mock, MockInstance } from 'vitest';
|
|
|
24
24
|
*
|
|
25
25
|
* @remarks
|
|
26
26
|
* Discovery walks the **prototype chain**, so a callable assigned in the constructor is invisible to
|
|
27
|
-
* it: an arrow-function property, an Angular `signal()` field
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* it: an arrow-function property, an Angular `signal()` field. Name those in `instanceMethodsToSpyOn`
|
|
28
|
+
* — or build the double from the type instead, with `createAutoMock<T>()`, which reads no prototype
|
|
29
|
+
* at all. A class built on an ngrx `signalStore()` gets `fillMissing: true` by default.
|
|
30
30
|
*/
|
|
31
31
|
declare function createSpyFromClass<T, Options extends SpyOptions = SpyOptions>(ObjectClass: ClassType<T>, methodsToSpyOnOrConfig?: ClassSpyConfiguration<T> | OnlyMethodKeysOf<T>[]): Spy<T, Options>;
|
|
32
32
|
|
package/dist/bun.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './chunk-QDBRZQJO.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-
|
|
3
|
-
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-
|
|
4
|
-
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './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-5D5GTU4A.js';
|
|
3
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-RCUQDITG.js';
|
|
4
|
+
export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-Z7RCF47R.js';
|
|
5
5
|
import './chunk-W5EXSI22.js';
|
|
6
6
|
import './chunk-TXDBDMIL.js';
|
|
7
7
|
import './chunk-FOL5RH22.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { currentSpecFile } from './chunk-
|
|
2
|
-
import { createSpyFromClass } from './chunk-
|
|
1
|
+
import { currentSpecFile } from './chunk-RCUQDITG.js';
|
|
2
|
+
import { createSpyFromClass } from './chunk-Z7RCF47R.js';
|
|
3
3
|
import { isAutoSpyLike, misconfigurationThrows, reportMisconfiguration } from './chunk-Q7L4AWI7.js';
|
|
4
4
|
import { angularInjectSpyReal } from './chunk-5FQZGJLJ.js';
|
|
5
5
|
import { withDocs } from './chunk-ENCEEH23.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
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-RCUQDITG.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-Z7RCF47R.js';
|
|
3
3
|
import { unpatchedSetTimeout, unpatchedClearTimeout, fakeClockAdvice, fakeClockBacklog } from './chunk-W5EXSI22.js';
|
|
4
4
|
import { redefineFailure } from './chunk-FOL5RH22.js';
|
|
5
5
|
import { DISPOSE } from './chunk-PC3FAZT3.js';
|