/** * Shared test helpers for openapi-zod-ts unit tests. * * Extracted to avoid duplicating boilerplate across test files. * Import with the .js extension as required by NodeNext module resolution: * import { compileFiles, compileSingleFile, makeSpec } from './helpers.js' */ import ts from 'typescript'; import type { OpenAPIV3_1 } from 'openapi-types'; /** * Build a minimal valid OpenAPI 3.1.0 document, optionally merged with * caller-supplied overrides. The merge is shallow at the top level and one * level deep for `paths` and `components`. * * Use this to keep per-test spec literals focused on the delta rather than * repeating the same boilerplate skeleton in every file. */ export declare function makeSpec(overrides?: Partial): OpenAPIV3_1.Document; /** * Compile multiple in-memory TypeScript files together using the TypeScript * compiler API. Files are keyed by bare names (e.g. 'models.ts') and stored * under /virtual/. Relative imports between virtual files are resolved via * resolveModuleNameLiterals. * * Returns only diagnostics that belong to the virtual files (i.e. errors in * lib.d.ts or node_modules are excluded). */ export declare function compileFiles(files: Record): readonly ts.Diagnostic[]; /** * Compile a single in-memory TypeScript source string. Use this for tests * that verify a standalone generated file (e.g. models.ts, client-config.ts) * without needing cross-file imports. * * The `lib` option defaults to ['ES2022']. Pass `{ lib: ['ES2022', 'DOM'] }` * when the generated file uses browser globals (e.g. RequestInit, fetch). */ export declare function compileSingleFile(filename: string, source: string, opts?: { lib?: string[]; }): readonly ts.Diagnostic[]; /** * Assert that a TypeScript compilation produced no diagnostics. Throws a * descriptive error listing all messages when diagnostics are present. * * @param diagnostics - result from compileFiles or compileSingleFile * @param context - short label for the error message, e.g. "generated models.ts" */ export declare function assertNoTsDiagnostics(diagnostics: readonly ts.Diagnostic[], context: string): void; //# sourceMappingURL=helpers.d.ts.map