You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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})
The text was updated successfully, but these errors were encountered:
You're right @ianwalter - we need better tests for sure. As I see it right now there's two aspects to testing: internal and apis for external testing. I'm open for ideas to both. I started writing some utility functions for internal testing the other day - maybe we can merge the two?
Yea being able to call/emit a keypress function/readline event with ‘\n’ would suffice although it doesnt bypass showing the prompt like inject does which I think might be ideal for testing.
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 isundefined
prompts would just use the initial value. e.g.:The text was updated successfully, but these errors were encountered: