/** * Contract test helpers — generate Vitest cases from a `FederationContract` * so a host can verify that every advertised export still resolves on the * remote. * * The helper is framework-neutral: it returns plain async functions, so it * also runs under Jest, node:test, or any home-grown harness. */ import type { FederationContract } from './federation-contract.js'; import { type ContractViolation } from './federation-contract.js'; export type Container = { get: (key: string) => Promise<() => unknown>; }; export interface ContractCheck { name: string; run: () => Promise; } export interface ContractSuiteOptions { /** Skip the deep container.get checks (run structural checks only). */ shallow?: boolean; } /** * Build a list of named checks ready to be plugged into any test runner: * * ```ts * import { describe, it, expect } from 'vitest'; * import { contractChecks } from '@jorvel/types/testing'; * * describe('dashboard contract', () => { * for (const check of contractChecks(contract, () => loadContainer())) { * it(check.name, async () => { * expect(await check.run()).toEqual([]); * }); * } * }); * ``` */ export declare function contractChecks(contract: FederationContract, loadContainer: () => Container | Promise | null | undefined, opts?: ContractSuiteOptions): ContractCheck[]; /** * Single-shot assertion helper. Throws when the contract is violated. * Use inside a single test case when you don't need per-export reporting. */ export declare function assertContract(contract: FederationContract, loadContainer: () => Container | Promise | null | undefined, opts?: ContractSuiteOptions): Promise; /** * Generate a TypeScript source string for a scaffolded vitest contract test. * Used by `jorvel generate contract-test` to drop a starting file into a host * package. The generated file imports the contract and a loader the user * implements (`loadContainer()`). */ export interface GenerateOptions { /** Import path to the contract file (relative to the generated test). */ contractImport: string; /** Variable name exported by the contract file. */ contractExport: string; /** Optional import for `loadContainer`. */ loaderImport?: string; /** Loader export name. Default: `loadContainer`. */ loaderExport?: string; } export declare function generateContractTestSource(opts: GenerateOptions): string; //# sourceMappingURL=contract-test.d.ts.map