Skip to content

TestAnswer

A queued answer consumed by createTestPrompter.

The test prompter returns these values exactly as provided; it does not coerce them. The one exception mirrors the terminal prompter: a string answer to an input prompt is run through the prompt's validate function, and a failing answer is rejected as a cancellation (see createTestPrompter). The normal resolution pipeline performs any later type coercion, so tests can supply values in the same shapes real prompts would yield:

  • string for input and select
  • boolean for confirm
  • string[] for multiselect
  • PROMPT_CANCEL to simulate user cancellation

Because the type is intentionally unknown, tests may also inject malformed answers to exercise downstream validation and error reporting.

Signatures

ts
type TestAnswer = unknown;

See Also

Released under the MIT License.