terkelg/prompts

Asynchronous validation causes subsequent keystrokes to fail

wsmud opened this issue · 0 comments

wsmud commented

Describe the bug

using asynchronous validation under Windows causes subsequent keystrokes to fail

To Reproduce

Steps to reproduce the behavior:

const prompts = require('prompts');

(async () => {
  const questions = [
    {
      type: 'text',
      name: 'test1',
      message: 'test1',
      async validate() {
        return new Promise((resolve) => setTimeout(() => resolve(true), 300));
      },
    },
    {
      type: 'select',
      name: 'test2',
      message: 'test2',
      choices: ['a', 'b', 'c'],
    },
    {
      type: 'select',
      name: 'test3',
      message: 'test3',
      choices: ['d', 'e', 'f'],
    },
  ];

  await prompts(questions);
})();

Expected behavior

A clear and concise description of what you expected to happen.

System

  • OS: Windows 10
  • Terminal: PowerShell
  • Node version: v16.14.0

Additional context

Add any other context about the problem here.