mock-prompt

0.1.5 • Public • Published

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 © 汪磊

Readme

Keywords

Package Sidebar

Install

npm i mock-prompt

Weekly Downloads

59

Version

0.1.5

License

MIT

Unpacked Size

5.71 kB

Total Files

5

Last publish

Collaborators

  • zce