vitest-auto-spy 5.51.0 → 5.52.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 CHANGED
@@ -10,6 +10,20 @@ The latest released version here must always match the one published on
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [5.52.0] - 2026-09-29
14
+
15
+ ### Added
16
+
17
+ - **`init` says when git will not show what it wrote.** A created or updated file that is ignored
18
+ and not tracked (`.git/info/exclude`, a global excludes file) ends its row with _not tracked by
19
+ git, so `git diff` will not show this change_, and an empty `git diff` no longer reads as "nothing
20
+ changed".
21
+
22
+ ### Documentation
23
+
24
+ - **When `prepareShallow` pays off**: only when the tests share non-empty `providers` or `imports`.
25
+ With a different `inputs` per call, or none, it only renames `renderShallow`.
26
+
13
27
  ## [5.51.0] - 2026-09-29
14
28
 
15
29
  ### Changed
@@ -6617,7 +6631,8 @@ moved under 1 %: `/angular` +192 B (+1.0 %) for the override queue and the HTTP
6617
6631
  This copy ships with the package and carries 5.x only. Releases before 5.0.0 are in the
6618
6632
  [full changelog](https://github.com/ASDAlexey/vitest-auto-spy/blob/master/CHANGELOG.md).
6619
6633
 
6620
- [Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.51.0...HEAD
6634
+ [Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.52.0...HEAD
6635
+ [5.52.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.51.0...v5.52.0
6621
6636
  [5.51.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.50.0...v5.51.0
6622
6637
  [5.50.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.49.0...v5.50.0
6623
6638
  [5.49.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.48.0...v5.49.0
@@ -267,6 +267,8 @@ describe renders the same component with the same providers, `prepareShallow(Com
267
267
  them once and each test calls `.create({ inputs: { … } })` — the overrides replace a key outright,
268
268
  one instance per test. `create({ providers })` replaces the prepared list; `create({ extraProviders,
269
269
  extraImports })` appends to it, so for one token the per-test provider wins (type `ShallowOverrides<T>`).
270
+ It pays off only on shared non-empty `providers` / `imports`: when each call passes its own `inputs`
271
+ or none, `prepareShallow(X)` only renames `renderShallow(X)` — keep `renderShallow`.
270
272
 
271
273
  ### Observers the component constructs itself
272
274
 
package/dist/angular.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import './vitest-mock-types-B17-xaWt.js';
2
- export { w as AngularTokenProvider, A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, E as ElementConstructor, N as NativeElementHolder, P as PreparedShallow, R as RenderShallowOptions, c as ResourceStatusLike, d as RunCounter, S as SettleResourceOptions, e as ShallowOverrides, f as ShallowRender, g as SpyRegistry, h as StableOptions, i as createWithAutoSpies, j as flushEffects, k as hostElement, l as injectSpy, p as prepareShallow, m as provideAutoSpy, x as provideAutoSpyForToken, q as queryElement, r as renderShallow, n as runEffect, s as setInputs, o as settleResource, t as stable, u as trackEffectRuns, v as trackRecomputations } from './track-signal-runs-DDzbFmGc.js';
2
+ export { w as AngularTokenProvider, A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, E as ElementConstructor, N as NativeElementHolder, P as PreparedShallow, R as RenderShallowOptions, c as ResourceStatusLike, d as RunCounter, S as SettleResourceOptions, e as ShallowOverrides, f as ShallowRender, g as SpyRegistry, h as StableOptions, i as createWithAutoSpies, j as flushEffects, k as hostElement, l as injectSpy, p as prepareShallow, m as provideAutoSpy, x as provideAutoSpyForToken, q as queryElement, r as renderShallow, n as runEffect, s as setInputs, o as settleResource, t as stable, u as trackEffectRuns, v as trackRecomputations } from './track-signal-runs-CM-leczv.js';
3
3
  import { o as DeepPartial, m as ClassType, C as ClassSpyConfiguration, S as Spy, t as OnlyMethodKeysOf, h as AddSpyMethodsByReturnTypes, r as NotAPublicKey } from './types-qYoxQi5C.js';
4
4
  export { J as SubjectOf } from './types-qYoxQi5C.js';
5
5
  import { InjectionToken, Provider, Type, WritableSignal, Signal } from '@angular/core';
@@ -4,7 +4,7 @@ export { A as AutoMockConfiguration, a as AutoMocked, b as AutoSpyDefaultEntry,
4
4
  export { c as createFunctionSpy, d as describeDuplicateCopies, g as getPackageCopies } from './package-identity-COBYU0WJ.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-CE9gNMPY.js';
6
6
  export { C as CreateNestUnitOptions, N as NestUnit, a as NestUnitClass, b as NestUnitProvider, c as NestUnitSpies, d as createNestUnit } from './nest-unit-Bg6JWPgu.js';
7
- export { A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, E as ElementConstructor, N as NativeElementHolder, P as PreparedShallow, R as RenderShallowOptions, c as ResourceStatusLike, d as RunCounter, S as SettleResourceOptions, e as ShallowOverrides, f as ShallowRender, g as SpyRegistry, h as StableOptions, i as createWithAutoSpies, j as flushEffects, k as hostElement, l as injectSpy, p as prepareShallow, m as provideAutoSpy, q as queryElement, r as renderShallow, n as runEffect, s as setInputs, o as settleResource, t as stable, u as trackEffectRuns, v as trackRecomputations } from './track-signal-runs-DDzbFmGc.js';
7
+ export { A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, E as ElementConstructor, N as NativeElementHolder, P as PreparedShallow, R as RenderShallowOptions, c as ResourceStatusLike, d as RunCounter, S as SettleResourceOptions, e as ShallowOverrides, f as ShallowRender, g as SpyRegistry, h as StableOptions, i as createWithAutoSpies, j as flushEffects, k as hostElement, l as injectSpy, p as prepareShallow, m as provideAutoSpy, q as queryElement, r as renderShallow, n as runEffect, s as setInputs, o as settleResource, t as stable, u as trackEffectRuns, v as trackRecomputations } from './track-signal-runs-CM-leczv.js';
8
8
  import '@angular/core';
9
9
  import '@angular/core/testing';
10
10
 
package/dist/cli.js CHANGED
@@ -1654,7 +1654,7 @@ function foreignPragmaPass() {
1654
1654
  }
1655
1655
 
1656
1656
  // src/cli/checks/export-map.generated.ts
1657
- var EXPORT_MAP_VERSION = "5.50.0";
1657
+ var EXPORT_MAP_VERSION = "5.51.0";
1658
1658
  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";
1659
1659
  var EXPORTED_BY = {
1660
1660
  AccessorImplementations: "0 1 2 3 4 12 20 21 22",
@@ -3853,6 +3853,13 @@ Options
3853
3853
  -v, --version Print the installed version.
3854
3854
 
3855
3855
  Docs https://asdalexey.github.io/vitest-auto-spy`;
3856
+ function ignoredByGit(cwd, paths) {
3857
+ if (paths.length === 0) {
3858
+ return /* @__PURE__ */ new Set();
3859
+ }
3860
+ const result = spawnSync("git", ["check-ignore", "--", ...paths], { cwd, encoding: "utf8" });
3861
+ return new Set(result.status === 0 ? result.stdout.split("\n").filter((line) => line !== "") : []);
3862
+ }
3856
3863
  var MARKER_BEGIN = /<!-- vitest-auto-spy:begin[^>]*-->/;
3857
3864
  var MARKER_END = "<!-- vitest-auto-spy:end -->";
3858
3865
  function digest(body) {
@@ -4305,10 +4312,20 @@ function unmatchedWarnings(only) {
4305
4312
  return guess === void 0 ? `--only ${entry} selects no file init writes. Known targets: ${known.join(", ")}.` : `--only ${entry} selects no file init writes. Did you mean ${guess}?`;
4306
4313
  });
4307
4314
  }
4315
+ var UNTRACKED_NOTE = "not tracked by git, so `git diff` will not show this change";
4316
+ function markUntracked(cwd, actions) {
4317
+ const ignored = ignoredByGit(
4318
+ cwd,
4319
+ actions.filter((action) => action.status === "created" || action.status === "updated").map((action) => action.path)
4320
+ );
4321
+ return actions.map((action) => ignored.has(action.path) ? { ...action, note: `${action.note} \u2014 ${UNTRACKED_NOTE}` } : action);
4322
+ }
4308
4323
  var PENDING = /* @__PURE__ */ new Set(["created", "edited", "stale", "updated"]);
4309
4324
  function runInit(profile, version, options) {
4310
4325
  const plans = buildPlans(profile, version, options.only).map((plan) => options.uninstall ? uninstallPlan(plan) : guardHandEdited(plan));
4311
- const { actions, failures } = applyPlans(profile.cwd, plans, options);
4326
+ const applied = applyPlans(profile.cwd, plans, options);
4327
+ const actions = markUntracked(profile.cwd, applied.actions);
4328
+ const { failures } = applied;
4312
4329
  const pending = options.check && actions.some((action) => PENDING.has(action.status));
4313
4330
  return {
4314
4331
  actions,
@@ -379,6 +379,9 @@ interface PreparedShallow<T> {
379
379
  * `TestBed.resetTestingModule()`, because Angular refuses a second `configureTestingModule` on an
380
380
  * already-instantiated module.
381
381
  *
382
+ * It pays off only when the tests share non-empty `providers` / `imports`. When each call passes its
383
+ * own `inputs` or none, it only renames `renderShallow(Component)`.
384
+ *
382
385
  * ```ts
383
386
  * const prepare = prepareShallow(TaskListComponent, { providers: [provideAutoSpy(TaskService)] });
384
387
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-auto-spy",
3
- "version": "5.51.0",
3
+ "version": "5.52.0",
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",