import { SpyImpl } from 'tinyspy'; import { m as SuiteAPI, l as TestAPI, al as BenchmarkAPI, o as SuiteHooks, H as HookListener, s as TestContext, S as Suite, n as HookCleanupCallback, h as Test } from './global-e98f203b.js'; interface MockResultReturn { type: 'return'; value: T; } interface MockResultIncomplete { type: 'incomplete'; value: undefined; } interface MockResultThrow { type: 'throw'; value: any; } declare type MockResult = MockResultReturn | MockResultThrow | MockResultIncomplete; interface MockContext { calls: TArgs[]; instances: TReturns[]; invocationCallOrder: number[]; results: MockResult[]; lastCall: TArgs | undefined; } declare type Procedure = (...args: any[]) => any; declare type Methods = { [K in keyof T]: T[K] extends Procedure ? K : never; }[keyof T] & (string | symbol); declare type Properties = { [K in keyof T]: T[K] extends Procedure ? never : K; }[keyof T] & (string | symbol); declare type Classes = { [K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never; }[keyof T] & (string | symbol); interface SpyInstance { getMockName(): string; mockName(n: string): this; mock: MockContext; mockClear(): this; mockReset(): this; mockRestore(): void; getMockImplementation(): ((...args: TArgs) => TReturns) | undefined; mockImplementation(fn: ((...args: TArgs) => TReturns) | (() => Promise)): this; mockImplementationOnce(fn: ((...args: TArgs) => TReturns) | (() => Promise)): this; mockReturnThis(): this; mockReturnValue(obj: TReturns): this; mockReturnValueOnce(obj: TReturns): this; mockResolvedValue(obj: Awaited): this; mockResolvedValueOnce(obj: Awaited): this; mockRejectedValue(obj: any): this; mockRejectedValueOnce(obj: any): this; } interface MockInstance extends SpyInstance { } interface Mock extends SpyInstance { new (...args: TArgs): TReturns; (...args: TArgs): TReturns; } interface PartialMock extends SpyInstance> { new (...args: TArgs): TReturns; (...args: TArgs): TReturns; } declare type MaybeMockedConstructor = T extends new (...args: Array) => infer R ? Mock, R> : T; declare type MockedFunction = Mock, ReturnType> & { [K in keyof T]: T[K]; }; declare type PartiallyMockedFunction = PartialMock, ReturnType> & { [K in keyof T]: T[K]; }; declare type MockedFunctionDeep = Mock, ReturnType> & MockedObjectDeep; declare type PartiallyMockedFunctionDeep = PartialMock, ReturnType> & MockedObjectDeep; declare type MockedObject = MaybeMockedConstructor & { [K in Methods]: T[K] extends Procedure ? MockedFunction : T[K]; } & { [K in Properties]: T[K]; }; declare type MockedObjectDeep = MaybeMockedConstructor & { [K in Methods]: T[K] extends Procedure ? MockedFunctionDeep : T[K]; } & { [K in Properties]: MaybeMockedDeep; }; declare type MaybeMockedDeep = T extends Procedure ? MockedFunctionDeep : T extends object ? MockedObjectDeep : T; declare type MaybePartiallyMockedDeep = T extends Procedure ? PartiallyMockedFunctionDeep : T extends object ? MockedObjectDeep : T; declare type MaybeMocked = T extends Procedure ? MockedFunction : T extends object ? MockedObject : T; declare type MaybePartiallyMocked = T extends Procedure ? PartiallyMockedFunction : T extends object ? MockedObject : T; interface Constructable { new (...args: any[]): any; } declare type MockedClass = MockInstance any ? P : never, InstanceType> & { prototype: T extends { prototype: any; } ? Mocked : never; } & T; declare type Mocked = { [P in keyof T]: T[P] extends (...args: infer Args) => infer Returns ? MockInstance : T[P] extends Constructable ? MockedClass : T[P]; } & T; declare type EnhancedSpy = SpyInstance & SpyImpl; declare function spyOn>>(obj: T, methodName: S, accessType: 'get'): SpyInstance<[], T[S]>; declare function spyOn>>(obj: T, methodName: G, accessType: 'set'): SpyInstance<[T[G]], void>; declare function spyOn> | Classes>)>(obj: T, methodName: M): Required[M] extends (...args: infer A) => infer R | (new (...args: infer A) => infer R) ? SpyInstance : never; declare function fn(): Mock; declare function fn(implementation: (...args: TArgs) => R): Mock; declare const suite: SuiteAPI<{}>; declare const test: TestAPI<{}>; declare const bench: BenchmarkAPI; declare const describe: SuiteAPI<{}>; declare const it: TestAPI<{}>; declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number) => void; declare const afterAll: (fn: SuiteHooks['afterAll'][0], timeout?: number) => void; declare const beforeEach: (fn: HookListener<[TestContext & ExtraContext, Suite], HookCleanupCallback>, timeout?: number) => void; declare const afterEach: (fn: HookListener<[TestContext & ExtraContext, Suite], void>, timeout?: number) => void; declare function createExpect(test?: Test): Vi.ExpectStatic; declare const globalExpect: Vi.ExpectStatic; export { EnhancedSpy as E, MaybeMockedDeep as M, SpyInstance as S, MaybeMocked as a, MaybePartiallyMocked as b, MaybePartiallyMockedDeep as c, suite as d, describe as e, fn as f, bench as g, beforeAll as h, it as i, afterAll as j, beforeEach as k, afterEach as l, globalExpect as m, createExpect as n, MockedFunction as o, MockedObject as p, MockInstance as q, Mock as r, spyOn as s, test as t, MockContext as u, Mocked as v, MockedClass as w };