mock-prompt
v0.1.5
Published
mock inquirer prompt
Downloads
444
Readme
mock-prompt
mock inquirer prompt for unit/e2e test
TODO
Make sure the inquirer instance is one.
Installation
$ yarn add mock-prompt --dev
# or npm
$ npm install mock-prompt --save-dev
Usage
const inquirer = require('inquirer')
const mockPrompt = require('mock-prompt')
mockPrompt({ foo: 'hello foo' })
const questions = [
{ name: 'foo', type: 'input', message: 'foo' },
{ name: 'bar', type: 'confirm', message: 'bar', default: false }
]
inquirer.prompt(questions)
.then(answers => {
console.log(answers)
// => { foo: 'hello foo', bar: false }
})
API
mockPrompt(fills)
fills
- Type:
object
- Details: fill answers
Contributing
- Fork it on GitHub!
- Clone the fork to your own machine.
- Checkout your feature branch:
git checkout -b my-awesome-feature
- Commit your changes to your own branch:
git commit -am 'Add some feature'
- Push your work back up to your fork:
git push -u origin my-awesome-feature
- Submit a Pull Request so that we can review your changes.
NOTE: Be sure to merge the latest from "upstream" before making a pull request!