UNPKG

@inquirer/testing

Version:
22 lines (21 loc) 796 B
import type { Prompt } from '@inquirer/type'; import { Screen } from './screen.ts'; declare const screenInstance: Screen; export { screenInstance as screen }; /** * Wrap a prompt function to use the shared screen I/O. * Use this in your own `jest.mock()` calls to mock third-party prompts. * * @example * ```ts * jest.mock('@my-company/custom-prompt', () => { * const { wrapPrompt } = jest.requireActual('@inquirer/testing/jest'); * const actual = jest.requireActual('@my-company/custom-prompt'); * return { ...actual, default: wrapPrompt(actual.default) }; * }); * ``` */ export declare function wrapPrompt<Value, Config>(prompt: Prompt<Value, Config> | { default: Prompt<Value, Config>; }): Prompt<Value, Config>; export { Screen, type KeypressEvent } from './screen.ts';