/** * Test fixtures for isolating host code from real Module Federation containers. * * Two ways to use: * * 1. `createMockRemoteLoader(...)` — returns a drop-in replacement for * `loadRemoteModule` you can inject via Vitest's `vi.mock` or your own * dependency-injection layer. * * 2. `installMockRemote(name, modules)` — installs a fake container on * `globalThis` so the production `loadRemoteEntry` / `loadRemoteModule` * flow returns the stub. Requires a DOM-like env (jsdom) because * `loadRemoteEntry` checks for `document` + `window`. */ import type { FederationRemote } from './remote-loader.js'; export type MockRemoteModules = Record; export interface MockRemoteSpec { name: string; /** Exposed-name → module object. Module shape matches what the real remote exports. */ modules: MockRemoteModules; /** Override entry URL (default: `mock:///remoteEntry.js`). */ entryUrl?: string; } export interface MockRemoteHandle extends FederationRemote { /** Remove the global container installed by `installMockRemote`. */ uninstall(): void; } /** * Returns a drop-in `loadRemoteModule` replacement that consults the supplied * mock map. Use with `vi.mock('@jorvel/runtime', ...)` to short-circuit network * loads in tests. */ export declare function createMockRemoteLoader(mocks: Record): (remote: FederationRemote, exposedModule: string) => Promise; /** * Installs a fake federation container at `globalThis[name]` so the real * `loadRemoteEntry` / `loadRemoteModule` returns the stubbed module. * * Must be called from a jsdom-like env (it stubs the script tag the loader * normally injects so the loader detects "already loaded"). * * @returns a `FederationRemote` you can pass to host code, plus an `uninstall` * function that removes the global container and script. */ export declare function installMockRemote(spec: MockRemoteSpec): MockRemoteHandle; /** Install many mock remotes at once. Returns a single `uninstallAll` cleanup. */ export declare function installMockRemotes(specs: MockRemoteSpec[]): { remotes: MockRemoteHandle[]; uninstallAll(): void; }; //# sourceMappingURL=testing.d.ts.map