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>
This commit is contained in:
Tobias Nießen 2022-08-30 22:31:11 +02:00 committed by GitHub
parent 63aba5672c
commit 4d8674b50f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ const stream = new Writable({
});
const myConsole = new Console(stream, stream);
process.on('warning', common.mustNotCall);
process.on('warning', common.mustNotCall());
stream.cork();
for (let i = 0; i < EventEmitter.defaultMaxListeners + 1; i++) {

View File

@ -141,7 +141,7 @@ function onSession(session, next) {
function testNoTls() {
// HTTP/1.1 client
get(Object.assign(parse(origin), clientOptions), common.mustNotCall)
get(Object.assign(parse(origin), clientOptions), common.mustNotCall())
.on('error', common.mustCall(cleanup))
.on('error', common.mustCall(testWrongALPN))
.end();

View File

@ -124,7 +124,7 @@ const Readable = require('stream').Readable;
assert.strictEqual(state.reading, false);
assert.strictEqual(state.readingMore, false);
const onReadable = common.mustNotCall;
const onReadable = common.mustNotCall();
readable.on('readable', onReadable);

View File

@ -53,7 +53,7 @@ nonStringInputs.forEach(common.mustCall((input) => {
unzips.forEach(common.mustCall((uz, i) => {
uz.on('error', common.mustCall());
uz.on('end', common.mustNotCall);
uz.on('end', common.mustNotCall());
// This will trigger error event
uz.write('this is not valid compressed data.');

View File

@ -7,12 +7,12 @@ const message = 'Come on, Fhqwhgads.';
const buffer = Buffer.from(message);
const zipper = new zlib.Gzip();
zipper.on('close', common.mustNotCall);
zipper.on('close', common.mustNotCall());
const zipped = zipper._processChunk(buffer, zlib.constants.Z_FINISH);
const unzipper = new zlib.Gunzip();
unzipper.on('close', common.mustNotCall);
unzipper.on('close', common.mustNotCall());
const unzipped = unzipper._processChunk(zipped, zlib.constants.Z_FINISH);
assert.notStrictEqual(zipped.toString(), message);