mocha-streambuffer
A small utility to assert console output in mocha tests
Usage
const StreamBuffer = ;const assert = ; var stdout; ;
StreamBuffer(stream, [verbose=true])
stream: The stream to buffer
verbose: Whether to still write to the stream
StreamBuffer.hook() => this
Starts buffering
StreamBuffer.unhook() => this
Stops buffering
StreamBuffer.buffer() => String
Returns the buffer
StreamBuffer.clean() => String
Resets the buffer and returns it
Credits
jjm for this excellent post on stackoverflow.