Thanks to visit codestin.com
Credit goes to github.com

Skip to content

askoufis/cli-testing-library

 
 

Repository files navigation

CLI Testing Library [WIP]

koala

Simple and complete CLI testing utilities that encourage good testing practices.


Build Status version downloads MIT License All Contributors PRs Welcome Code of Conduct

All Contributors

Watch on GitHub Star on GitHub

Table of Contents

This project is not affiliated with the "Testing Library" ecosystem that this project is clearly inspired from. We're just big fans :)

Installation

This module is distributed via [npm][npm] which is bundled with [node][node] and should be installed as one of your project's devDependencies:

npm install --save-dev cli-testing-library

Usage

This is currently the only section of "usage" documentation. We'll be expanding it as soon as possible

Usage example:

const {resolve} = require('path')
const {render, fireEvent} = require('cli-testing-library')

test('Is able to make terminal input and view in-progress stdout', async () => {
  const {cleanup, findByText} = await render('node', [
    resolve(__dirname, './execute-scripts/stdio-inquirer.js'),
  ])

  const instance = await findByText('First option')

  expect(instance).toBeTruthy()

  expect(await findByText('❯ One')).toBeTruthy()

  cleanup()

  fireEvent.down(instance)

  expect(await findByText('❯ Two')).toBeTruthy()

  cleanup()

  fireEvent.enter(instance)

  expect(await findByText('First option: Two')).toBeTruthy()
})

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Corbin Crutchley

💻 📖 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

About

🐨 Simple and complete CLI testing utilities that encourage good testing practices.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • TypeScript 92.3%
  • JavaScript 4.6%
  • MDX 1.8%
  • Other 1.3%