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

Error when testing optional required anwswer #151

@tiagoporto

Description

@tiagoporto

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions