/stdout-stderr

mock stdout and stderr

Primary LanguageTypeScript

stdout-stderr

mock stdout and stderr

Version Known Vulnerabilities Downloads/week License

Usage:

const {stdout, stderr} = require('stdout-stderr')

stdout.start()                                // start mocking stdout
console.log('writing to stdout')              // this will not be displayed
stdout.stop()                                 // stop mocking stdout
assert(stdout.output === 'writing to stdout') // view the output


/* options */
stdout.stripColor = false // disable automatic ansi code stripping
stdout.print = true       // also output to screen

This uses the debug module so you can also see the output by setting DEBUG=stdout|stderr|*.