Skip to content
This repository has been archived by the owner on Feb 5, 2022. It is now read-only.

Error when testing optional required anwswer #151

Open
tiagoporto opened this issue Aug 17, 2020 · 0 comments
Open

Error when testing optional required anwswer #151

tiagoporto opened this issue Aug 17, 2020 · 0 comments

Comments

@tiagoporto
Copy link

First of all, amazing tool, thanks.

My prompt has 2 questions, second depends on the first, testing when I pass an option to the first one and the second is not necessary Im getting an error

saofile.js

prompts() {
    return [
      {
        name: 'group',
        message: 'Choose a group?',
        type: 'list',
        default: 'none',
        choices: ['none', 'one', 'two']
      },
      {
        name: 'newGroup',
        message: 'New group name?',
        default: 'Other',
        when: ({ group }) => group === 'none',
        required: true
      }
    ]
  },

Test file

const stream = await sao.mock(
      {  generator },
      {
        group: 'one',
        newGroup: 'Other'
      }
    )

Error

  missing answer for required prompt: [object Object]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant