fixture-stdout
A test fixture to intercept writes to stdout.
Install:
npm install fixture-stdout
Example Usage:
var StdOutFixture = ;var fixture = ; // Keep track of writes so we can check them later..var _writes = ; // Capture a write to stdoutfixture; // Uses intercepted version of stdoutconsole;console; fixture; // Now we're back to the original version of stdoutconsole;console; // Voila!// Only the first two logs ("a" and "b") are in our `_writes` array
stdout
:
Watch streams other than var Fixture = ; var fixture = stream: processstderr; fixture;console;fixture;console;
Credit
Based on @pguillory's example.
License
MIT