From 4d8674b50f6050d5dad649dbd32ce60cbd24f362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Tue, 30 Aug 2022 22:31:11 +0200 Subject: [PATCH] test: fix multiple incorrect mustNotCall() uses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Juan José Arboleda Reviewed-By: James M Snell --- test/parallel/test-console-log-stdio-broken-dest.js | 2 +- test/parallel/test-http2-https-fallback.js | 2 +- test/parallel/test-stream-readable-reading-readingMore.js | 2 +- test/parallel/test-zlib-invalid-input.js | 2 +- test/parallel/test-zlib-sync-no-event.js | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-console-log-stdio-broken-dest.js b/test/parallel/test-console-log-stdio-broken-dest.js index d29e8ee517..bdd1b79427 100644 --- a/test/parallel/test-console-log-stdio-broken-dest.js +++ b/test/parallel/test-console-log-stdio-broken-dest.js @@ -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++) { diff --git a/test/parallel/test-http2-https-fallback.js b/test/parallel/test-http2-https-fallback.js index 24283b775d..8e0612375f 100644 --- a/test/parallel/test-http2-https-fallback.js +++ b/test/parallel/test-http2-https-fallback.js @@ -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(); diff --git a/test/parallel/test-stream-readable-reading-readingMore.js b/test/parallel/test-stream-readable-reading-readingMore.js index 968bf5c63a..5e39c86dcb 100644 --- a/test/parallel/test-stream-readable-reading-readingMore.js +++ b/test/parallel/test-stream-readable-reading-readingMore.js @@ -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); diff --git a/test/parallel/test-zlib-invalid-input.js b/test/parallel/test-zlib-invalid-input.js index 67793984a9..7aa44dfe70 100644 --- a/test/parallel/test-zlib-invalid-input.js +++ b/test/parallel/test-zlib-invalid-input.js @@ -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.'); diff --git a/test/parallel/test-zlib-sync-no-event.js b/test/parallel/test-zlib-sync-no-event.js index 479aa1c411..e7f25c8476 100644 --- a/test/parallel/test-zlib-sync-no-event.js +++ b/test/parallel/test-zlib-sync-no-event.js @@ -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);