SBoudrias / Inquirer.js

A collection of common interactive command line user interfaces.
MIT License
20.26k stars 1.31k forks source link

Input Glitch While Running On Nodemon #873

Closed karanius closed 1 month ago

karanius commented 4 years ago

This issue involves an inability to correct input's persistency to keep the bad value of an input after submission. 1) The question would be re-prompted and the previously wrong input would then persist into the next round of newly printed prompt. 2) Inability to choose an answer from prompt of list type.

Of course it must be mentioned that this happens with nodemon only, and everything runs smoothly when you node index.js .

Expected Behavior

Inquirer is expected to print a new, fresh prompt if the wrong input is entered.

Current Behavior

when the program is running on nodemon, the newly printed prompt persists on keeping the value of the bad input from the the previous entry.

Possible Solution

go to node_modules/inquirer/lib/prompts/input.js - line: 94 && replaceLineWith => { this.rl.line += '' }

Steps to Reproduce

  1. clone my repo
  2. npm install
  3. run the app with nodemon (the bug will present itself)
  4. run the app as node index.js (the bug will NOT present itself)
  5. go to node_modules/inquirer/lib/prompts/input.js - line: 94 && replaceLineWith => { this.rl.line += '' }
  6. run the app with nodemon again (the bug will NOT present itself)

Context (Environment)

I have ( @karanius ) employed inquirer as part of an assignment and had to correct the library in a similar manner. As this appears to be a recent discussion (closed two weeks ago) this appears to have impacted the development of my assignment (although it has not appeared to impact others). The repo in question is at https://github.com/karanius/TeamGenerator .

I wrote this with the help of my instructors: @eapostol & @seang

eapostol commented 4 years ago

@karanius - referencing issue discussed at https://github.com/remy/nodemon/issues/1041 (nodemon and inquirer js are known not to work together). It may be that they just don't operate together. It was suggested to disable the auto-restart feature of nodemon .(see https://github.com/remy/nodemon/blob/master/faq.md#nodemon-doesnt-work-with-my-repl) .You may recall that nodemon is not a requirement for your app to work (you can run it as a stand-alone and manually refresh). However, it is good to note for @SBoudrias that quite a few people would use nodemon for testing and would appreciate any feedback or comment on it. cheers.

SBoudrias commented 4 years ago

If someone wants to investigate this issue and send a PR, I'll be happy to help merging.

Nodemon isn't a tool I'm using developing Inquirer UI, so I'm not planning to dig deep into this issue (I want to make sure the expectations are clear for everyone.)

If you're not sure how to go about debugging the issue, providing a link to a repository with a minimal reproduction case would go a long way to help other potential contributor jump on this issue faster.

SBoudrias commented 1 month ago

[cleaning up old issues] - There's now some documentation on using with Nodemon