zod-opts
Version:
node.js CLI option parser / validator using Zod
24 lines (23 loc) • 1.1 kB
TypeScript
import { jest } from "@jest/globals";
import type { BaseType, InternalOption, InternalPositionalArgument } from "../src/type";
export declare function mockConsole(type?: "error" | "warn" | "debug" | "log"): any;
export declare function mockExit(): jest.SpiedFunction<typeof process.exit>;
export declare function expectExit0(expectedMessage: string, f: () => void): void;
export declare function expectProcessExit(expectedMessage: string, exitCode: number, f: () => void): void;
export declare function createInternalOption({ type, name, alias, required, description, defaultValue, enumValues, isArray, }: {
type?: BaseType;
name?: string;
alias?: string;
required?: boolean;
description?: string;
defaultValue?: number | string | boolean;
enumValues?: string[];
isArray?: boolean;
}): InternalOption;
export declare function createInternalPositionalArgument({ type, name, required, isArray, enumValues, }: {
type?: "string" | "number";
name?: string;
required?: boolean;
isArray?: boolean;
enumValues?: string[];
}): InternalPositionalArgument;