@joegesualdo/capture-output-node
v0.0.2
Published
Capture console.log output. Useful for testing cli modules.
Downloads
12
Maintainers
Readme
capture-output
Capture console.log output. Useful for testing cli modules.
Install
$ npm install --save @joegesualdo/capture-output-node
Usage
import CaptureOutput from '@joegesualdo/capture-output-node';
var capturedOutput = new CaptureOutput();
console.log('Woowee')
capturedOutput.get()
.then((output) => {
// output === 'Woowee'
})
Test
$ npm test
API
constructor()
Creates an intance of CaptureOutput
Returns: CapturedOutput
, instance of CaptureOutput
import CaptureOutput from '@joegesualdo/capture-output-node';
var capturedOutput = new CaptureOutput();
get()
Gets the output that was captured from the time you created the CaptureOutput instance.
Returns: Promise
, The promise passes a string (utf8) that represent everything that was printed to the output since the instance of CatpureOuput was initialized.
import CaptureOutput from '@joegesualdo/capture-output-node';
var capturedOutput = new CaptureOutput();
console.log('Woowee')
capturedOutput.get()
.then((output) => {
// output === 'Woowee'
})
Build
$ npm run build
License
MIT © Joe Gesualdo