terkelg/prompts

Convenient way to select initial values in tests

Open

#44 opened on Mar 4, 2018

View on GitHub
 (3 comments) (1 reaction) (0 assignees)JavaScript (325 forks)batch import
help wanted

Repository metrics

Stars
 (8,482 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

inject is great when, within a test, you want to simulate the user supplying an answer, but what about when you want to simulate them choosing the initial or default value? I can submit a PR if we can decide on how to implement this. My proposal is that if an injected answer is undefined prompts would just use the initial value. e.g.:

prompts.inject({ a: undefined })

Contributor guide