@deployable/test-cli

0.2.0 • Public • Published

Deployable - Test Cli

@deployable/test-cli

Helper classes for testing cli commands and cli code.

Stores the stdout, stderr and return of the command for subsequent testing.

Install

yarn add deployable-test-cli --dev

npm install deployable-test-cli --save-dev

Usage

Cli

const { Cli } = require('@deployable/test-cli') 
Cli.run(['echo', 'test']).then(results => {
  console.log(results.stdout)
  console.log(results.stdout)
  console.log(results.exit_code)
})

Cli Code

const { CliCode } = require('@deployable/test-cli') 

const fn = ()=> { 
  console.log('testout')
  console.error('testerr')
  process.exit(1)
}

CliCode.run(fn).then(results => {
  console.log(results.stdout)
  console.log(results.stdout)
  console.log(results.return) // The data the function returns
  console.log(results.exit)   // Did the code try to exit
  console.log(results.exit_code) // What was the exit code
})

About

deployable-test-cli is released under the MIT license.

Copyright 2016 Matt Hoyle - code at deployable.co

https://github.com/deployable/deployable-test-cli

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.2.0-10testing
0.2.01latest

Version History

VersionDownloads (Last 7 Days)Published
0.2.01
0.2.0-10
0.2.1-00
0.1.00
0.1.0-30

Package Sidebar

Install

npm i @deployable/test-cli

Weekly Downloads

1

Version

0.2.0

License

MIT

Last publish

Collaborators

  • deployable