2019-03-09 20:49:24 -08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Test that monkeypatching console._stdout and console._stderr works.
|
|
|
|
const common = require('../common');
|
|
|
|
|
|
|
|
const { Writable } = require('stream');
|
|
|
|
|
|
|
|
const streamToNowhere = new Writable({ write: common.mustCall() });
|
|
|
|
const anotherStreamToNowhere = new Writable({ write: common.mustCall() });
|
|
|
|
|
2019-03-19 21:05:59 -07:00
|
|
|
// Overriding the lazy-loaded _stdout and _stderr properties this way is what we
|
|
|
|
// are testing. Don't change this to be a Console instance from calling a
|
|
|
|
// constructor. It has to be the global `console` object.
|
|
|
|
console._stdout = streamToNowhere;
|
|
|
|
console._stderr = anotherStreamToNowhere;
|
2019-03-09 20:49:24 -08:00
|
|
|
|
2019-03-19 21:05:59 -07:00
|
|
|
console.log('fhqwhgads');
|
|
|
|
console.error('fhqwhgads');
|