mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
ee429e4b2c
test-console-stdio-setters needs to test against the global console in order to test the setters for the lazy-loaded _stdout and _stderr properties. PR-URL: https://github.com/nodejs/node/pull/26796 Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
19 lines
654 B
JavaScript
19 lines
654 B
JavaScript
'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() });
|
|
|
|
// 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;
|
|
|
|
console.log('fhqwhgads');
|
|
console.error('fhqwhgads');
|