11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// Test that monkeypatching console._stdout and console._stderr works. 41cb0ef41Sopenharmony_ciconst common = require('../common'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst { Writable } = require('stream'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst streamToNowhere = new Writable({ write: common.mustCall() }); 91cb0ef41Sopenharmony_ciconst anotherStreamToNowhere = new Writable({ write: common.mustCall() }); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci// Overriding the lazy-loaded _stdout and _stderr properties this way is what we 121cb0ef41Sopenharmony_ci// are testing. Don't change this to be a Console instance from calling a 131cb0ef41Sopenharmony_ci// constructor. It has to be the global `console` object. 141cb0ef41Sopenharmony_ciconsole._stdout = streamToNowhere; 151cb0ef41Sopenharmony_ciconsole._stderr = anotherStreamToNowhere; 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciconsole.log('fhqwhgads'); 181cb0ef41Sopenharmony_ciconsole.error('fhqwhgads'); 19