From 76cb9c2a39d477a64824a985ade40507e3bbade1 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Fri, 13 Feb 2026 21:34:48 -0800 Subject: feat(vanilla): add testing infrastructure and tests (NK-wjnczv) --- .../@vitest/mocker/dist/mocker.d-TnKRhz7N.d.ts | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 vanilla/node_modules/@vitest/mocker/dist/mocker.d-TnKRhz7N.d.ts (limited to 'vanilla/node_modules/@vitest/mocker/dist/mocker.d-TnKRhz7N.d.ts') diff --git a/vanilla/node_modules/@vitest/mocker/dist/mocker.d-TnKRhz7N.d.ts b/vanilla/node_modules/@vitest/mocker/dist/mocker.d-TnKRhz7N.d.ts new file mode 100644 index 0000000..db47e96 --- /dev/null +++ b/vanilla/node_modules/@vitest/mocker/dist/mocker.d-TnKRhz7N.d.ts @@ -0,0 +1,81 @@ +import { MaybeMockedDeep } from '@vitest/spy'; +import { b as ModuleMockOptions, c as ModuleMockFactoryWithHelper, a as MockedModule, M as MockerRegistry, d as MockedModuleType } from './types.d-B8CCKmHt.js'; +import { C as CreateMockInstanceProcedure } from './index.d-C-sLYZi-.js'; + +interface CompilerHintsOptions { + /** + * This is the key used to access the globalThis object in the worker. + * Unlike `globalThisAccessor` in other APIs, this is not injected into the script. + * ```ts + * // globalThisKey: '__my_variable__' produces: + * globalThis['__my_variable__'] + * // globalThisKey: '"__my_variable__"' produces: + * globalThis['"__my_variable__"'] // notice double quotes + * ``` + * @default '__vitest_mocker__' + */ + globalThisKey?: string; +} +interface ModuleMockerCompilerHints { + hoisted: (factory: () => T) => T; + mock: (path: string | Promise, factory?: ModuleMockOptions | ModuleMockFactoryWithHelper) => void; + unmock: (path: string | Promise) => void; + doMock: (path: string | Promise, factory?: ModuleMockOptions | ModuleMockFactoryWithHelper) => void; + doUnmock: (path: string | Promise) => void; + importActual: (path: string) => Promise; + importMock: (path: string) => Promise>; +} +declare function createCompilerHints(options?: CompilerHintsOptions): ModuleMockerCompilerHints; + +interface ModuleMockerInterceptor { + register: (module: MockedModule) => Promise; + delete: (url: string) => Promise; + invalidate: () => Promise; +} + +declare class ModuleMocker { + private interceptor; + private rpc; + private createMockInstance; + private config; + protected registry: MockerRegistry; + private queue; + private mockedIds; + constructor(interceptor: ModuleMockerInterceptor, rpc: ModuleMockerRPC, createMockInstance: CreateMockInstanceProcedure, config: ModuleMockerConfig); + prepare(): Promise; + resolveFactoryModule(id: string): Promise>; + getFactoryModule(id: string): any; + invalidate(): Promise; + importActual(id: string, importer: string): Promise; + importMock(rawId: string, importer: string): Promise; + mockObject(object: Record, moduleType?: "automock" | "autospy"): Record; + queueMock(rawId: string, importer: string, factoryOrOptions?: ModuleMockOptions | (() => any)): void; + queueUnmock(id: string, importer: string): void; + wrapDynamicImport(moduleFactory: () => Promise): Promise; + private resolveMockPath; +} +interface ResolveIdResult { + id: string; + url: string; + optimized: boolean; +} +interface ResolveMockResult { + mockType: MockedModuleType; + resolvedId: string; + resolvedUrl: string; + redirectUrl?: string | null; + needsInterop?: boolean; +} +interface ModuleMockerRPC { + invalidate: (ids: string[]) => Promise; + resolveId: (id: string, importer: string) => Promise; + resolveMock: (id: string, importer: string, options: { + mock: "spy" | "factory" | "auto"; + }) => Promise; +} +interface ModuleMockerConfig { + root: string; +} + +export { ModuleMocker as b, createCompilerHints as c }; +export type { CompilerHintsOptions as C, ModuleMockerInterceptor as M, ResolveIdResult as R, ModuleMockerCompilerHints as a, ModuleMockerConfig as d, ModuleMockerRPC as e, ResolveMockResult as f }; -- cgit v1.2.3