JSPM

  • Created
  • Published
  • Downloads 4185
  • Score
    100M100P100Q114727F
  • License MIT

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

Package Exports

  • cli-testing-library
  • cli-testing-library/dist/cli-testing-library.esm.js
  • cli-testing-library/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-testing-library) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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!