0.1.5 • Published 4 years ago

mock-prompt v0.1.5

Weekly downloads
34
License
MIT
Repository
github
Last release
4 years ago

mock-prompt

Build Status Coverage Status NPM Downloads NPM Version License Dependency Status devDependency Status Code Style

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

  1. Fork it on GitHub!
  2. Clone the fork to your own machine.
  3. Checkout your feature branch: git checkout -b my-awesome-feature
  4. Commit your changes to your own branch: git commit -am 'Add some feature'
  5. Push your work back up to your fork: git push -u origin my-awesome-feature
  6. 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!

License

MIT © 汪磊

0.1.5

4 years ago

0.1.4

5 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago