Skip to content

Commit 9ca4ce3

Browse files
TrottMylesBorins
authored andcommitted
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: #26796 Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 513913c commit 9ca4ce3

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

test/parallel/test-console-stdio-setters.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
const common = require('../common');
55

66
const { Writable } = require('stream');
7-
const { Console } = require('console');
87

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

13-
// Overriding the _stdout and _stderr properties this way is what we are
14-
// testing. Don't change this to be done via arguments passed to the constructor
15-
// above.
16-
myConsole._stdout = streamToNowhere;
17-
myConsole._stderr = anotherStreamToNowhere;
11+
// Overriding the lazy-loaded _stdout and _stderr properties this way is what we
12+
// are testing. Don't change this to be a Console instance from calling a
13+
// constructor. It has to be the global `console` object.
14+
console._stdout = streamToNowhere;
15+
console._stderr = anotherStreamToNowhere;
1816

19-
myConsole.log('fhqwhgads');
20-
myConsole.error('fhqwhgads');
17+
console.log('fhqwhgads');
18+
console.error('fhqwhgads');

0 commit comments

Comments
 (0)