From 9ca4ce3cc30250ec9494a90f89325ab44a4a6ee1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 19 Mar 2019 21:05:59 -0700 Subject: [PATCH] test: fix test-console-stdio-setters to test setters 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 Reviewed-By: Colin Ihrig --- test/parallel/test-console-stdio-setters.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-console-stdio-setters.js b/test/parallel/test-console-stdio-setters.js index 6c7d0adfa03aed..5a4f511ee97bbb 100644 --- a/test/parallel/test-console-stdio-setters.js +++ b/test/parallel/test-console-stdio-setters.js @@ -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');