0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-console-log-stdio-broken-dest.js
Tobias Nießen 4d8674b50f
test: fix multiple incorrect mustNotCall() uses
This does not fix occurrences in test/parallel/test-dns-* because those
tests contain unrelated pre-existing bugs that would cause the tests to
fail with this fix. This unrelated bug in those tests should be fixed
separately before the use of mustNotCall() can be fixed in those files.

PR-URL: https://github.com/nodejs/node/pull/44022
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-08-30 20:31:11 +00:00

25 lines
547 B
JavaScript

'use strict';
const common = require('../common');
const { Writable } = require('stream');
const { Console } = require('console');
const { EventEmitter } = require('events');
const stream = new Writable({
write(chunk, enc, cb) {
cb();
},
writev(chunks, cb) {
setTimeout(cb, 10, new Error('kaboom'));
}
});
const myConsole = new Console(stream, stream);
process.on('warning', common.mustNotCall());
stream.cork();
for (let i = 0; i < EventEmitter.defaultMaxListeners + 1; i++) {
myConsole.log('a message');
}
stream.uncork();