import { C as ClassType, S as Spy } from './types-BM3BcWj1.js'; /** * The provider shape Angular and NestJS agree on: `{ provide, useFactory }`, with the dependency * list (`deps` / `inject`) omitted because the factory takes none. */ interface TrackedProvider { provide: unknown; useFactory: () => unknown; } /** How {@link trackInjections} builds its doubles. */ interface TrackInjectionsOptions { /** * Build the double for a token. Defaults to {@link createSpyForToken} — a class spy for a class, * `createAutoMock()` for anything else. Pass this when a collaborator has to be a real object (a * `FormBuilder`, a config literal) rather than a spy. */ double?: (token: unknown) => unknown; } /** The providers, plus the ordered record of which of their tokens DI constructed. */ interface InjectionLog { /** Hand these to `TestBed.configureTestingModule({ providers })` or `Test.createTestingModule({ providers })`. */ readonly providers: TrackedProvider[]; /** The tokens DI asked for, in the order their factories ran. A copy — mutating it changes nothing. */ injectedTokens(): unknown[]; /** The same list as names, which is what makes a failing `toEqual` readable. */ names(): string[]; /** Whether DI ever constructed `token`. */ wasInjected(token: unknown): boolean; /** The double registered for `token`, typed as a spy. Throws when the token was never tracked. */ get(token: ClassType | (abstract new (...args: never[]) => D)): Spy; get(token: unknown): Spy; /** Forget the record. The doubles are untouched — reset those with `resetAutoSpy`. */ reset(): void; } /** * Track which of `tokens` the code under test injects. * * ```ts * const collaborators = trackInjections([FeatureFlagService, ANALYTICS_TOKEN]); * * TestBed.configureTestingModule({ providers: [CheckoutFacade, ...collaborators.providers] }); * collaborators.get(FeatureFlagService).isOn.mockReturnValue(true); * * TestBed.inject(CheckoutFacade).start(); * * expect(collaborators.names()).toEqual(['FeatureFlagService']); // analytics was never asked for * ``` * * The doubles are built up front, so a spec can stub one before the entry point runs; the *record* * fills in only as DI constructs them. A factory runs once per injector, so a token appears once * per injector that asked for it. */ declare function trackInjections(tokens: readonly unknown[], options?: TrackInjectionsOptions): InjectionLog; export { type InjectionLog as I, type TrackInjectionsOptions as T, type TrackedProvider as a, trackInjections as t };