vitest-auto-spy 5.40.0 → 5.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,26 @@ The latest released version here must always match the one published on
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [5.40.1] - 2026-09-27
14
+
15
+ ### Changed
16
+
17
+ - **`toHaveDirectiveApplied` prints class names as the source spells them.** Under
18
+ `@angular/build:unit-test` esbuild emits a decorated class as `_TestIdDirective`, and the failure told
19
+ the reader to edit `_ReportRenameComponent`, a name no file contains. The leading `_` (and a Rollup
20
+ `$1` suffix) now comes off, the way strict-mode messages already took it off a spied class.
21
+
22
+ ### Fixed
23
+
24
+ - **`toHaveDirectiveApplied` finds a structural directive.** `*dir` and `<ng-template dir>` put the
25
+ directive on the comment Angular leaves in place of the template, and the search read elements only,
26
+ so a directive that rendered its view failed the matcher, whose hint then advised the
27
+ `createDirectiveHost({ template, scope })` the spec already used. The search now takes template
28
+ anchors in; `.not` reports them as `1 template anchor`, and a selector naming the rendered element
29
+ fails with a message that says to drop it. `/angular/matchers` is +226 B min+gzip (2015 → 2241 B,
30
+ +11.2 %) and +1.0 kB to import (18929 → 19972 B): the anchor search, its two messages and the
31
+ class-name cleanup.
32
+
13
33
  ## [5.40.0] - 2026-09-27
14
34
 
15
35
  ### Added
@@ -5541,7 +5561,8 @@ moved under 1 %: `/angular` +192 B (+1.0 %) for the override queue and the HTTP
5541
5561
  This copy ships with the package and carries 5.x only. Releases before 5.0.0 are in the
5542
5562
  [full changelog](https://github.com/ASDAlexey/vitest-auto-spy/blob/master/CHANGELOG.md).
5543
5563
 
5544
- [Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.40.0...HEAD
5564
+ [Unreleased]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.40.1...HEAD
5565
+ [5.40.1]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.40.0...v5.40.1
5545
5566
  [5.40.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.39.0...v5.40.0
5546
5567
  [5.39.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.38.0...v5.39.0
5547
5568
  [5.38.0]: https://github.com/ASDAlexey/vitest-auto-spy/compare/v5.37.0...v5.38.0
@@ -1207,7 +1207,9 @@ assertion on the attribute alone stays green when the entry is dropped and the a
1207
1207
  written statically, or set by something else; the fixture's root element is searched, so the entry
1208
1208
  itself can be asserted with no selector. On a fixture of the component under test the failure names
1209
1209
  that component's `hostDirectives` / `imports` as the fix; only a spec-built host (`createDirectiveHost`,
1210
- `TestBed.createDirective`) is pointed at `createDirectiveHost`:
1210
+ `TestBed.createDirective`) is pointed at `createDirectiveHost`. A structural directive (`*dir`,
1211
+ `<ng-template dir>`) counts too: it sits on the template's comment anchor, which the search includes;
1212
+ assert it without a selector, since the element it renders does not carry it:
1211
1213
 
1212
1214
  ```ts
1213
1215
  import { registerDirectiveMatchers } from 'vitest-auto-spy/angular/matchers';
@@ -1,14 +1,14 @@
1
- import { pendingRequestsReport, assertAngularInternals, instrumentTestBed, onTestingModuleConfigured, onComponentCreated, beforeTestBedReset, verifyOnTeardown } from './chunk-GKSVYPZQ.js';
2
- export { disableTestBedDiagnostics, enableTestBedDiagnostics, formatSpecTiming, getTestBedTiming, instrumentTestBed, reportSpecTiming } from './chunk-GKSVYPZQ.js';
3
- import { failOnUnspiedProvider } from './chunk-3UUM6YM5.js';
1
+ import { pendingRequestsReport, assertAngularInternals, instrumentTestBed, onTestingModuleConfigured, onComponentCreated, beforeTestBedReset, verifyOnTeardown } from './chunk-JFOJFCVQ.js';
2
+ export { disableTestBedDiagnostics, enableTestBedDiagnostics, formatSpecTiming, getTestBedTiming, instrumentTestBed, reportSpecTiming } from './chunk-JFOJFCVQ.js';
3
+ import { failOnUnspiedProvider } from './chunk-YPDMNJDB.js';
4
4
  import './chunk-GG7BQKEK.js';
5
- import './chunk-RCUQDITG.js';
6
- import './chunk-Z7RCF47R.js';
5
+ import './chunk-MNY4ZHEQ.js';
6
+ import './chunk-H54YPKPT.js';
7
7
  import './chunk-FOL5RH22.js';
8
8
  import './chunk-PC3FAZT3.js';
9
- import './chunk-RYFF55PV.js';
9
+ import './chunk-HUS2MHK5.js';
10
10
  import { isAutoSpyLike } from './chunk-Q7L4AWI7.js';
11
- import { count, taskName } from './chunk-M3NTXLZG.js';
11
+ import { count, taskName } from './chunk-DYAS4OK4.js';
12
12
  import { angularPendingRequests, angularShadowedProviders, angularDeadSchemas, angularNgModuleScopesAuto } from './chunk-5FQZGJLJ.js';
13
13
  import { withDocs } from './chunk-ENCEEH23.js';
14
14
  import { getTestBed } from '@angular/core/testing';
@@ -1,13 +1,13 @@
1
1
  import { describeInstance } from './chunk-BS432KB2.js';
2
- import { useVitestAdapter } from './chunk-YNXQ2WFH.js';
3
- import './chunk-B6C3K27C.js';
2
+ import { useVitestAdapter } from './chunk-6ZGH56G4.js';
3
+ import './chunk-IE4NI2OQ.js';
4
4
  import './chunk-YHDBRBGU.js';
5
5
  import './chunk-TXDBDMIL.js';
6
6
  import './chunk-FOL5RH22.js';
7
7
  import './chunk-PC3FAZT3.js';
8
- import { createFunctionSpy } from './chunk-RYFF55PV.js';
8
+ import { createFunctionSpy } from './chunk-HUS2MHK5.js';
9
9
  import './chunk-Q7L4AWI7.js';
10
- import './chunk-M3NTXLZG.js';
10
+ import './chunk-DYAS4OK4.js';
11
11
  import { angularDialog } from './chunk-5FQZGJLJ.js';
12
12
  import { withDocs } from './chunk-ENCEEH23.js';
13
13
  import { TestBed } from '@angular/core/testing';
@@ -1,8 +1,8 @@
1
- import { assertAngularInternals, pendingRequestsReport, verifyOnTeardown, beforeTestBedReset } from './chunk-GKSVYPZQ.js';
2
- import { flushEffects } from './chunk-DBC6526L.js';
1
+ import { assertAngularInternals, pendingRequestsReport, verifyOnTeardown, beforeTestBedReset } from './chunk-JFOJFCVQ.js';
2
+ import { flushEffects } from './chunk-UH3KWLVL.js';
3
3
  import './chunk-GG7BQKEK.js';
4
- import './chunk-W5EXSI22.js';
5
- import { count, taskName } from './chunk-M3NTXLZG.js';
4
+ import './chunk-HVNKTPKG.js';
5
+ import { count, taskName } from './chunk-DYAS4OK4.js';
6
6
  import { angularHttpNoRequest, angularHttpPending, angularHttpController, angularHttpExpectRequest } from './chunk-5FQZGJLJ.js';
7
7
  import { withDocs } from './chunk-ENCEEH23.js';
8
8
  import { provideHttpClient } from '@angular/common/http';
@@ -1,8 +1,8 @@
1
- import { count } from './chunk-M3NTXLZG.js';
1
+ import { sourceClassName, count } from './chunk-DYAS4OK4.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, reflectComponentType } from '@angular/core';
5
+ import { ɵSIGNAL as _SIGNAL, isStandalone, DebugElement, reflectComponentType } from '@angular/core';
6
6
  import { By } from '@angular/platform-browser';
7
7
  import { expect } from 'vitest';
8
8
 
@@ -23,6 +23,17 @@ function rootOf(received) {
23
23
  function matching(root, predicate) {
24
24
  return predicate(root) ? [root, ...root.queryAll(predicate)] : root.queryAll(predicate);
25
25
  }
26
+ function matchingNodes(root, predicate) {
27
+ return predicate(root) ? [root, ...root.queryAllNodes(predicate)] : root.queryAllNodes(predicate);
28
+ }
29
+ function isAnchor(node) {
30
+ return !(node instanceof DebugElement);
31
+ }
32
+ function located(nodes) {
33
+ const anchors = nodes.filter(isAnchor).length;
34
+ const elements = nodes.length - anchors;
35
+ return [elements > 0 ? count(elements, "element") : "", anchors > 0 ? count(anchors, "template anchor") : ""].filter((part) => part !== "").join(" and ");
36
+ }
26
37
  function isClass(value) {
27
38
  return typeof value === "function";
28
39
  }
@@ -33,12 +44,13 @@ function componentUnderTest(root) {
33
44
  return void 0;
34
45
  }
35
46
  const mirror = reflectComponentType(type);
36
- return mirror === null || mirror.selector.includes(TESTBED_DIRECTIVE_HOST) ? void 0 : type.name;
47
+ return mirror === null || mirror.selector.includes(TESTBED_DIRECTIVE_HOST) ? void 0 : sourceClassName(type.name);
37
48
  }
38
- function diagnose(directive, selector, root) {
49
+ function diagnose(directive, selector, root, withDirective) {
50
+ const name = sourceClassName(directive.name);
39
51
  const elements = selector === void 0 ? [] : matching(root, By.css(selector));
40
52
  const where = selector === void 0 ? "" : ` on '${selector}'`;
41
- const prefix = `[vitest-auto-spy] expected ${directive.name} to be applied${where}`;
53
+ const prefix = `[vitest-auto-spy] expected ${name} to be applied${where}`;
42
54
  if (selector !== void 0 && elements.length === 0) {
43
55
  return withDocs(
44
56
  `${prefix}, but no element matches that selector.
@@ -46,19 +58,26 @@ Run fixture.detectChanges() before asserting, and check the selector against the
46
58
  angularDirectiveApplied
47
59
  );
48
60
  }
61
+ if (selector !== void 0 && withDirective.some(isAnchor)) {
62
+ return withDocs(
63
+ `${prefix}, but it is on a template anchor, not on an element \u2014 a structural directive sits on the comment Angular leaves in place of its template.
64
+ Assert it without a selector: expect(fixture).toHaveDirectiveApplied(${name}).`,
65
+ angularDirectiveApplied
66
+ );
67
+ }
49
68
  const component = componentUnderTest(root);
50
69
  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`;
70
+ const scope = isStandalone(directive) ? `list ${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 ${name} to ${component}'s imports if its template uses it`;
52
71
  return withDocs(
53
72
  `${prefix}, but it is not on ${component}'s host element or in its template.
54
73
  To apply it, ${scope}.`,
55
74
  angularDirectiveApplied
56
75
  );
57
76
  }
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`;
77
+ const cause = isStandalone(directive) ? `${name} is standalone, so only the host component's own imports put it in scope` : `${name} is declared by an NgModule, and a test bundle drops that module's scope, so importing it contributes nothing`;
59
78
  return withDocs(
60
79
  `${prefix}, but it is not on any element of this fixture \u2014 ${cause}.
61
- Build the host with createDirectiveHost({ template, scope: [${isStandalone(directive) ? directive.name : "ItsModule"}] }).`,
80
+ Build the host with createDirectiveHost({ template, scope: [${isStandalone(directive) ? name : "ItsModule"}] }).`,
62
81
  angularDirectiveApplied
63
82
  );
64
83
  }
@@ -80,11 +99,11 @@ Pass the fixture itself, or fixture.debugElement \u2014 not fixture.nativeElemen
80
99
  )
81
100
  );
82
101
  }
83
- const withDirective = matching(root, By.directive(directive));
102
+ const withDirective = matchingNodes(root, By.directive(directive));
84
103
  const applied = selector === void 0 ? withDirective.length > 0 : matching(root, By.css(selector)).some((element) => element.providerTokens.includes(directive));
85
104
  return {
86
105
  pass: applied,
87
- message: () => applied ? `[vitest-auto-spy] expected ${directive.name} not to be applied, but it is on ${count(withDirective.length, "element")}.` : diagnose(directive, selector, root)
106
+ message: () => applied ? `[vitest-auto-spy] expected ${sourceClassName(directive.name)} not to be applied, but it is on ${located(withDirective)}.` : diagnose(directive, selector, root, withDirective)
88
107
  };
89
108
  }
90
109
  function registerDirectiveMatchers() {
@@ -1,8 +1,8 @@
1
1
  import { describeInstance } from './chunk-BS432KB2.js';
2
2
  import { angularInternalsError } from './chunk-GG7BQKEK.js';
3
- import { createFunctionSpy } from './chunk-RYFF55PV.js';
3
+ import { createFunctionSpy } from './chunk-HUS2MHK5.js';
4
4
  import './chunk-Q7L4AWI7.js';
5
- import { count } from './chunk-M3NTXLZG.js';
5
+ import { count } from './chunk-DYAS4OK4.js';
6
6
  import { angularRouteDouble, angularRouterInject, angularRouterEvents, angularLocationDouble, angularRouteWiring, angularRouterDouble } from './chunk-5FQZGJLJ.js';
7
7
  import { withDocs } from './chunk-ENCEEH23.js';
8
8
  import { TestBed } from '@angular/core/testing';
@@ -1,21 +1,21 @@
1
- import { createSpyForToken } from './chunk-UH3YJSRP.js';
2
- export { injectSpy, provideAutoSpy } from './chunk-3UUM6YM5.js';
3
- import { stable, flushEffects } from './chunk-DBC6526L.js';
4
- export { flushEffects, stable } from './chunk-DBC6526L.js';
1
+ import { createSpyForToken } from './chunk-IWTUXEAR.js';
2
+ export { injectSpy, provideAutoSpy } from './chunk-YPDMNJDB.js';
3
+ import { stable, flushEffects } from './chunk-UH3KWLVL.js';
4
+ export { flushEffects, stable } from './chunk-UH3KWLVL.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-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
- import { fakeClockBacklog } from './chunk-W5EXSI22.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-DQCAFHHR.js';
8
+ import { mockValueProp } from './chunk-MNY4ZHEQ.js';
9
+ export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-MNY4ZHEQ.js';
10
+ import { closestName } from './chunk-H54YPKPT.js';
11
+ export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-H54YPKPT.js';
12
+ import { fakeClockBacklog } from './chunk-HVNKTPKG.js';
13
13
  import './chunk-TXDBDMIL.js';
14
14
  import './chunk-FOL5RH22.js';
15
15
  import './chunk-PC3FAZT3.js';
16
- export { createFunctionSpy, errorHandler } from './chunk-RYFF55PV.js';
16
+ export { createFunctionSpy, errorHandler } from './chunk-HUS2MHK5.js';
17
17
  import { libraryWarn } from './chunk-Q7L4AWI7.js';
18
- import { displayPath, count } from './chunk-M3NTXLZG.js';
18
+ import { displayPath, count } from './chunk-DYAS4OK4.js';
19
19
  import { angularEffects, angularTrackRuns, bunAngular, angularUnreadResource, angularCreateWithAutoSpies, angularResources, angularTypedElements, angularInputs, angularKeepTemplate } from './chunk-5FQZGJLJ.js';
20
20
  import { withDocs } from './chunk-ENCEEH23.js';
21
21
  import '@angular/compiler';
package/dist/bun.js CHANGED
@@ -1,13 +1,13 @@
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-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
- import './chunk-W5EXSI22.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-DQCAFHHR.js';
3
+ export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-MNY4ZHEQ.js';
4
+ export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-H54YPKPT.js';
5
+ import './chunk-HVNKTPKG.js';
6
6
  import './chunk-TXDBDMIL.js';
7
7
  import './chunk-FOL5RH22.js';
8
8
  import './chunk-PC3FAZT3.js';
9
- export { createFunctionSpy, errorHandler } from './chunk-RYFF55PV.js';
9
+ export { createFunctionSpy, errorHandler } from './chunk-HUS2MHK5.js';
10
10
  import './chunk-Q7L4AWI7.js';
11
- import './chunk-M3NTXLZG.js';
11
+ import './chunk-DYAS4OK4.js';
12
12
  import './chunk-5FQZGJLJ.js';
13
13
  import './chunk-ENCEEH23.js';
@@ -1,4 +1,4 @@
1
- import { createRunnerMockAdapter } from './chunk-B6C3K27C.js';
1
+ import { createRunnerMockAdapter } from './chunk-IE4NI2OQ.js';
2
2
  import { SWEEP_SENTINEL } from './chunk-YHDBRBGU.js';
3
3
  import { hasMockAdapter, registerMockAdapter } from './shared-state.js';
4
4
  import { vi } from 'vitest';
@@ -1,11 +1,11 @@
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
- import { unpatchedSetTimeout, unpatchedClearTimeout, fakeClockAdvice, fakeClockBacklog } from './chunk-W5EXSI22.js';
1
+ import { mockValueProp, mockAccessorsProp } from './chunk-MNY4ZHEQ.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-H54YPKPT.js';
3
+ import { unpatchedSetTimeout, unpatchedClearTimeout, fakeClockAdvice, fakeClockBacklog } from './chunk-HVNKTPKG.js';
4
4
  import { redefineFailure } from './chunk-FOL5RH22.js';
5
5
  import { DISPOSE } from './chunk-PC3FAZT3.js';
6
- import { defineHelper, adoptFunctionSpy, reinstallDispatch, serializeValue, resolveUnstubbedGuard, createFunctionSpy } from './chunk-RYFF55PV.js';
6
+ import { defineHelper, adoptFunctionSpy, reinstallDispatch, serializeValue, resolveUnstubbedGuard, createFunctionSpy } from './chunk-HUS2MHK5.js';
7
7
  import { isMarkedMock, reportMisconfiguration, DEEP_CHILDREN } from './chunk-Q7L4AWI7.js';
8
- import { count, displayPath } from './chunk-M3NTXLZG.js';
8
+ import { count, displayPath } from './chunk-DYAS4OK4.js';
9
9
  import { moduleMocksAssert, moduleMocksNoOp, narrow, adoptMock, observableFailures, strictModePassthrough, createSpyFromClassReturns, captureArg, eventLoopUntil, mockConstructor, createSpyFromClassLiveDomNode } from './chunk-5FQZGJLJ.js';
10
10
  import { withDocs } from './chunk-ENCEEH23.js';
11
11
  import { getMockAdapter, emissionTimeout, registerEmissionWait, forgetEmissionWait } from './shared-state.js';
@@ -2,6 +2,9 @@
2
2
  function count(value, noun, plural = `${noun}s`) {
3
3
  return `${value} ${value === 1 ? noun : plural}`;
4
4
  }
5
+ function sourceClassName(name) {
6
+ return name.replace(/^_(?=[A-Z])/, "").replace(/\$\d+$/, "");
7
+ }
5
8
  function runnerRoot() {
6
9
  const config = Reflect.get(Object(Reflect.get(globalThis, "__vitest_worker__")), "config");
7
10
  const root = Reflect.get(Object(config), "root");
@@ -24,4 +27,4 @@ function taskName(task) {
24
27
  return names.join(" > ");
25
28
  }
26
29
 
27
- export { count, displayPath, taskName };
30
+ export { count, displayPath, sourceClassName, taskName };
@@ -1,5 +1,5 @@
1
1
  import { DISPOSE } from './chunk-PC3FAZT3.js';
2
- import { defaultStrict, resolveUnstubbedGuard, seedReturnValue, createFunctionSpy } from './chunk-RYFF55PV.js';
2
+ import { defaultStrict, resolveUnstubbedGuard, seedReturnValue, createFunctionSpy } from './chunk-HUS2MHK5.js';
3
3
  import { runClearHook, runConfigReset, reportMisconfiguration, AUTO_SPY_MARK, markAsMock, isMarkedMock, readDeepChildren } from './chunk-Q7L4AWI7.js';
4
4
  import { autoMockHeldBack, createSpyFromClassInstanceMethods, createSpyFromClassAccessors, createSpyFromClassReturns, createSpyFromClassLazySpies } from './chunk-5FQZGJLJ.js';
5
5
  import { withDocs } from './chunk-ENCEEH23.js';
@@ -1,5 +1,5 @@
1
1
  import { AUTO_SPY_MARK, attachHelpers, markAsMock, reportMisconfiguration, detachedHelperError, decorate } from './chunk-Q7L4AWI7.js';
2
- import { displayPath } from './chunk-M3NTXLZG.js';
2
+ import { sourceClassName, displayPath } from './chunk-DYAS4OK4.js';
3
3
  import { mustBeCalledWith, strictCall, createSpyFromClass } from './chunk-5FQZGJLJ.js';
4
4
  import { withDocs } from './chunk-ENCEEH23.js';
5
5
  import { getMockAdapter, getObservableSupport, getJasmineSupport, requireObservableSupport } from './shared-state.js';
@@ -800,9 +800,6 @@ function unwrapContainer(container) {
800
800
  return container.value;
801
801
  }
802
802
  var NO_MATCH = /* @__PURE__ */ Symbol("vitest-auto-spy.noMatch");
803
- function sourceClassName(name) {
804
- return name.replace(/^_(?=[A-Z])/, "").replace(/\$\d+$/, "");
805
- }
806
803
  function describeTarget(call) {
807
804
  return call.className === void 0 || call.className === "" ? call.method : `${sourceClassName(call.className)}.${call.method}`;
808
805
  }
@@ -1,4 +1,4 @@
1
- import { count } from './chunk-M3NTXLZG.js';
1
+ import { count } from './chunk-DYAS4OK4.js';
2
2
 
3
3
  // src/lib/fake-clock-state.ts
4
4
  function fakeClockBacklog(host = globalThis) {
@@ -1,6 +1,6 @@
1
1
  import { guardAccessorSpies, spyOnAccessorByRedefine } from './chunk-TXDBDMIL.js';
2
2
  import { DISPOSE } from './chunk-PC3FAZT3.js';
3
- import { isFastSpy, FAST_SPY_BRAND, isThenable } from './chunk-RYFF55PV.js';
3
+ import { isFastSpy, FAST_SPY_BRAND, isThenable } from './chunk-HUS2MHK5.js';
4
4
  import { setSharedHelperSink, hooksOf } from './chunk-Q7L4AWI7.js';
5
5
  import { mockConstructor } from './chunk-5FQZGJLJ.js';
6
6
  import { withDocs } from './chunk-ENCEEH23.js';
@@ -1,4 +1,4 @@
1
- import { createSpyFromClass, createAutoMock } from './chunk-Z7RCF47R.js';
1
+ import { createSpyFromClass, createAutoMock } from './chunk-H54YPKPT.js';
2
2
  import { trackInjectionsUntracked } from './chunk-5FQZGJLJ.js';
3
3
  import { withDocs } from './chunk-ENCEEH23.js';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { angularInternalsError } from './chunk-GG7BQKEK.js';
2
- import { count } from './chunk-M3NTXLZG.js';
2
+ import { count } from './chunk-DYAS4OK4.js';
3
3
  import { TestBed, getTestBed } from '@angular/core/testing';
4
4
  import { expect, beforeAll, afterAll } from 'vitest';
5
5
  import { signal, ɵSIGNAL as _SIGNAL } from '@angular/core';
@@ -1,6 +1,6 @@
1
1
  import { isCannotRedefine, redefineFailure } from './chunk-FOL5RH22.js';
2
2
  import { libraryWarn } from './chunk-Q7L4AWI7.js';
3
- import { count, displayPath } from './chunk-M3NTXLZG.js';
3
+ import { count, displayPath } from './chunk-DYAS4OK4.js';
4
4
  import { setupGlobals, setupWrongHook, setup } from './chunk-5FQZGJLJ.js';
5
5
  import { withDocs } from './chunk-ENCEEH23.js';
6
6
  import { getMockAdapter } from './shared-state.js';
@@ -1,5 +1,5 @@
1
- import { unpatchedSetTimeout, unpatchedClearTimeout, fakeClockBacklog } from './chunk-W5EXSI22.js';
2
- import { count } from './chunk-M3NTXLZG.js';
1
+ import { unpatchedSetTimeout, unpatchedClearTimeout, fakeClockBacklog } from './chunk-HVNKTPKG.js';
2
+ import { count } from './chunk-DYAS4OK4.js';
3
3
  import { angularStable } from './chunk-5FQZGJLJ.js';
4
4
  import { withDocs } from './chunk-ENCEEH23.js';
5
5
  import { NgZone } from '@angular/core';
@@ -1,5 +1,5 @@
1
- import { currentSpecFile } from './chunk-RCUQDITG.js';
2
- import { createSpyFromClass } from './chunk-Z7RCF47R.js';
1
+ import { currentSpecFile } from './chunk-MNY4ZHEQ.js';
2
+ import { createSpyFromClass } from './chunk-H54YPKPT.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';
package/dist/cli.js CHANGED
@@ -3446,7 +3446,7 @@ function checkForeignPragma(graph) {
3446
3446
  }
3447
3447
 
3448
3448
  // src/cli/checks/export-map.generated.ts
3449
- var EXPORT_MAP_VERSION = "5.39.0";
3449
+ var EXPORT_MAP_VERSION = "5.40.0";
3450
3450
  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";
3451
3451
  var EXPORTED_BY = {
3452
3452
  AccessorImplementations: "0 1 2 3 4 12 20 21 22",
package/dist/console.js CHANGED
@@ -1,12 +1,12 @@
1
- import { useVitestAdapter } from './chunk-YNXQ2WFH.js';
2
- import './chunk-B6C3K27C.js';
1
+ import { useVitestAdapter } from './chunk-6ZGH56G4.js';
2
+ import './chunk-IE4NI2OQ.js';
3
3
  import './chunk-YHDBRBGU.js';
4
4
  import './chunk-TXDBDMIL.js';
5
5
  import './chunk-FOL5RH22.js';
6
6
  import './chunk-PC3FAZT3.js';
7
- import { createFunctionSpy } from './chunk-RYFF55PV.js';
7
+ import { createFunctionSpy } from './chunk-HUS2MHK5.js';
8
8
  import './chunk-Q7L4AWI7.js';
9
- import './chunk-M3NTXLZG.js';
9
+ import './chunk-DYAS4OK4.js';
10
10
  import './chunk-5FQZGJLJ.js';
11
11
  import './chunk-ENCEEH23.js';
12
12
  import { getMockAdapter } from './shared-state.js';
package/dist/index.js CHANGED
@@ -1482,6 +1482,9 @@ Fix the value the code under test passes, or configure this call too.`;
1482
1482
  function count(value, noun, plural = `${noun}s`) {
1483
1483
  return `${value} ${value === 1 ? noun : plural}`;
1484
1484
  }
1485
+ function sourceClassName(name) {
1486
+ return name.replace(/^_(?=[A-Z])/, "").replace(/\$\d+$/, "");
1487
+ }
1485
1488
  function runnerRoot() {
1486
1489
  const config = Reflect.get(Object(Reflect.get(globalThis, "__vitest_worker__")), "config");
1487
1490
  const root = Reflect.get(Object(config), "root");
@@ -1641,9 +1644,6 @@ function unwrapContainer(container) {
1641
1644
  return container.value;
1642
1645
  }
1643
1646
  var NO_MATCH = /* @__PURE__ */ Symbol("vitest-auto-spy.noMatch");
1644
- function sourceClassName(name) {
1645
- return name.replace(/^_(?=[A-Z])/, "").replace(/\$\d+$/, "");
1646
- }
1647
1647
  function describeTarget(call) {
1648
1648
  return call.className === void 0 || call.className === "" ? call.method : `${sourceClassName(call.className)}.${call.method}`;
1649
1649
  }
package/dist/jasmine.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { enableJasmineCompat } from './chunk-3ZBRBPOL.js';
2
2
  export { enableJasmineCompat } from './chunk-3ZBRBPOL.js';
3
- import { createSpyFromClass } from './chunk-Z7RCF47R.js';
4
- import { useVitestAdapter } from './chunk-YNXQ2WFH.js';
5
- import './chunk-B6C3K27C.js';
3
+ import { createSpyFromClass } from './chunk-H54YPKPT.js';
4
+ import { useVitestAdapter } from './chunk-6ZGH56G4.js';
5
+ import './chunk-IE4NI2OQ.js';
6
6
  import './chunk-YHDBRBGU.js';
7
7
  import './chunk-TXDBDMIL.js';
8
8
  import './chunk-FOL5RH22.js';
9
9
  import './chunk-PC3FAZT3.js';
10
- import { createFunctionSpy } from './chunk-RYFF55PV.js';
10
+ import { createFunctionSpy } from './chunk-HUS2MHK5.js';
11
11
  import { reportMisconfiguration, misconfigurationThrows } from './chunk-Q7L4AWI7.js';
12
- import './chunk-M3NTXLZG.js';
12
+ import './chunk-DYAS4OK4.js';
13
13
  import { jasmineGlobals, jasmineClock, jasmineAutoSpies, jasmineTimeout } from './chunk-5FQZGJLJ.js';
14
14
  import { withDocs } from './chunk-ENCEEH23.js';
15
15
  import { expect, vi } from 'vitest';
package/dist/nestjs.js CHANGED
@@ -1,15 +1,15 @@
1
- import { createSpyForToken } from './chunk-UH3YJSRP.js';
2
- export { trackInjections } from './chunk-UH3YJSRP.js';
3
- import { createSpyFromClass } from './chunk-Z7RCF47R.js';
4
- import { useVitestAdapter } from './chunk-YNXQ2WFH.js';
5
- import './chunk-B6C3K27C.js';
1
+ import { createSpyForToken } from './chunk-IWTUXEAR.js';
2
+ export { trackInjections } from './chunk-IWTUXEAR.js';
3
+ import { createSpyFromClass } from './chunk-H54YPKPT.js';
4
+ import { useVitestAdapter } from './chunk-6ZGH56G4.js';
5
+ import './chunk-IE4NI2OQ.js';
6
6
  import './chunk-YHDBRBGU.js';
7
7
  import './chunk-TXDBDMIL.js';
8
8
  import './chunk-FOL5RH22.js';
9
9
  import './chunk-PC3FAZT3.js';
10
- import './chunk-RYFF55PV.js';
10
+ import './chunk-HUS2MHK5.js';
11
11
  import './chunk-Q7L4AWI7.js';
12
- import './chunk-M3NTXLZG.js';
12
+ import './chunk-DYAS4OK4.js';
13
13
  import { nestUnitRefusals } from './chunk-5FQZGJLJ.js';
14
14
  import { withDocs } from './chunk-ENCEEH23.js';
15
15
 
package/dist/node.cjs CHANGED
@@ -1077,6 +1077,9 @@ Fix the value the code under test passes, or configure this call too.`;
1077
1077
  function count(value, noun, plural = `${noun}s`) {
1078
1078
  return `${value} ${value === 1 ? noun : plural}`;
1079
1079
  }
1080
+ function sourceClassName(name) {
1081
+ return name.replace(/^_(?=[A-Z])/, "").replace(/\$\d+$/, "");
1082
+ }
1080
1083
  function runnerRoot() {
1081
1084
  const config = Reflect.get(Object(Reflect.get(globalThis, "__vitest_worker__")), "config");
1082
1085
  const root = Reflect.get(Object(config), "root");
@@ -1272,9 +1275,6 @@ function unwrapContainer(container) {
1272
1275
  return container.value;
1273
1276
  }
1274
1277
  var NO_MATCH = /* @__PURE__ */ Symbol("vitest-auto-spy.noMatch");
1275
- function sourceClassName(name) {
1276
- return name.replace(/^_(?=[A-Z])/, "").replace(/\$\d+$/, "");
1277
- }
1278
1278
  function describeTarget(call) {
1279
1279
  return call.className === void 0 || call.className === "" ? call.method : `${sourceClassName(call.className)}.${call.method}`;
1280
1280
  }
package/dist/node.js CHANGED
@@ -975,6 +975,9 @@ Fix the value the code under test passes, or configure this call too.`;
975
975
  function count(value, noun, plural = `${noun}s`) {
976
976
  return `${value} ${value === 1 ? noun : plural}`;
977
977
  }
978
+ function sourceClassName(name) {
979
+ return name.replace(/^_(?=[A-Z])/, "").replace(/\$\d+$/, "");
980
+ }
978
981
  function runnerRoot() {
979
982
  const config = Reflect.get(Object(Reflect.get(globalThis, "__vitest_worker__")), "config");
980
983
  const root = Reflect.get(Object(config), "root");
@@ -1161,9 +1164,6 @@ function unwrapContainer(container) {
1161
1164
  return container.value;
1162
1165
  }
1163
1166
  var NO_MATCH = /* @__PURE__ */ Symbol("vitest-auto-spy.noMatch");
1164
- function sourceClassName(name) {
1165
- return name.replace(/^_(?=[A-Z])/, "").replace(/\$\d+$/, "");
1166
- }
1167
1167
  function describeTarget(call) {
1168
1168
  return call.className === void 0 || call.className === "" ? call.method : `${sourceClassName(call.className)}.${call.method}`;
1169
1169
  }
package/dist/rstest.js CHANGED
@@ -1,14 +1,14 @@
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-5D5GTU4A.js';
2
- export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-RCUQDITG.js';
3
- export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-Z7RCF47R.js';
4
- import './chunk-W5EXSI22.js';
5
- import { createRunnerMockAdapter } from './chunk-B6C3K27C.js';
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-DQCAFHHR.js';
2
+ export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, reportPropsOutsideHooks, restoreMockedProps } from './chunk-MNY4ZHEQ.js';
3
+ export { autoMocked, clearAutoSpy, clearAutoSpyDefaults, createAutoMock, createSpyFromClass, registerAutoSpyDefaults, resetAutoSpy } from './chunk-H54YPKPT.js';
4
+ import './chunk-HVNKTPKG.js';
5
+ import { createRunnerMockAdapter } from './chunk-IE4NI2OQ.js';
6
6
  import './chunk-TXDBDMIL.js';
7
7
  import './chunk-FOL5RH22.js';
8
8
  import './chunk-PC3FAZT3.js';
9
- export { createFunctionSpy, errorHandler } from './chunk-RYFF55PV.js';
9
+ export { createFunctionSpy, errorHandler } from './chunk-HUS2MHK5.js';
10
10
  import './chunk-Q7L4AWI7.js';
11
- import './chunk-M3NTXLZG.js';
11
+ import './chunk-DYAS4OK4.js';
12
12
  import './chunk-5FQZGJLJ.js';
13
13
  import './chunk-ENCEEH23.js';
14
14
  import { rstest } from '@rstest/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-auto-spy",
3
- "version": "5.40.0",
3
+ "version": "5.40.1",
4
4
  "description": "Auto-generate fully-typed test spies from a class — across Vitest, Bun, node:test and Rstest, with Angular/NestJS/React/Vue/Svelte recipes. Drop-in replacement for jest-auto-spies and jasmine-auto-spies.",
5
5
  "keywords": [
6
6
  "auto-mock",