@inquirer/testing
Version:
Inquirer testing utilities
23 lines (22 loc) • 818 B
TypeScript
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 `vi.mock()` calls to mock third-party prompts.
*
* @example
* ```ts
* import { wrapPrompt } from '@inquirer/testing/vitest';
*
* vi.mock('@my-company/custom-prompt', async (importOriginal) => {
* const actual = await importOriginal<typeof import('@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';