capture stdout
Example:
const xstdout = require("xstdout");
const intercept = xstdout.intercept(true);
console.log("hello, world");
intercept.restore();
expect(intercept.stdout[0]).to.equal("hello, world\n");
Returns an object:
{
restore,
stdout,
stderr
}
stdout
/stderr
are arrays of strings that captured stdout/stderrrestore
is a function that restores the original stdout/stderr
silent
- iftrue
, then omit actual output to console and only capturesilentErr
- if notundefined
, then independently controls output of stderr to console