@joegesualdo/capture-output-node

0.0.2 • Public • Published

capture-output Build Status

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

Package Sidebar

Install

npm i @joegesualdo/capture-output-node

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • joegesualdo