Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix test-console-stdio-setters to test setters #26796

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions test/parallel/test-console-stdio-setters.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
const common = require('../common');

const { Writable } = require('stream');
const { Console } = require('console');

const streamToNowhere = new Writable({ write: common.mustCall() });
const anotherStreamToNowhere = new Writable({ write: common.mustCall() });
const myConsole = new Console(process.stdout);

// Overriding the _stdout and _stderr properties this way is what we are
// testing. Don't change this to be done via arguments passed to the constructor
// above.
myConsole._stdout = streamToNowhere;
myConsole._stderr = anotherStreamToNowhere;
// 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;

myConsole.log('fhqwhgads');
myConsole.error('fhqwhgads');
console.log('fhqwhgads');
console.error('fhqwhgads');