jamesshore / test-console

A simple and pragmatic library for testing Node.js console output.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for inspecting both stdout and stderr?

paambaati opened this issue · comments

commented

I'm not sure if this is technically feasible, but it would be great to inspect both stdout and stderr.

Use-case

Test a CLI program that writes to both stdout and stderr in a run.

They are both supported:

var stdout = require("test-console").stdout;
var stderr = require("test-console").stderr;

var stdoutInspect = stdout.inspect();
var stderrInspect = stderr.inspect();
functionUnderTest();
stdoutInspect.restore();
stderrInspect.restore();
assert.deepEqual(stdoutInspect.output, [ "foo\n" ]);
assert.deepEqual(stderrInspect.output, [ "bar\n" ]);