• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3// Test that monkeypatching console._stdout and console._stderr works.
4const common = require('../common');
5
6const { Writable } = require('stream');
7
8const streamToNowhere = new Writable({ write: common.mustCall() });
9const anotherStreamToNowhere = new Writable({ write: common.mustCall() });
10
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.
14console._stdout = streamToNowhere;
15console._stderr = anotherStreamToNowhere;
16
17console.log('fhqwhgads');
18console.error('fhqwhgads');
19