Repository: nodejs/node
Pull request: test: ensure assertions are reachable in `test/client-proxy`

Another follow up of https://github.com/nodejs/node/pull/60125
<!--
Before submitting a pull request, please read:

- the CONTRIBUTING guide at https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md
- the commit message formatting guidelines at
  https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#commit-message-guidelines

For code changes:
1. Include tests for any bug fixes or new features.
2. Update documentation if relevant.
3. Ensure that `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes.

If you believe this PR should be highlighted in the Node.js CHANGELOG
please add the `notable-change` label.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
-->


Changed files:
filename: test/client-proxy/test-http-proxy-request-invalid-char-in-url.mjs
patch: @@ -12,16 +12,16 @@ import { Worker } from 'node:worker_threads';
 const expectedProxyLogs = new Set();
 const proxyWorker = new Worker(fixtures.path('proxy-server-worker.js'));
 
-proxyWorker.on('message', (message) => {
+proxyWorker.on('message', common.mustCall((message) => {
   console.log('Received message from worker:', message.type);
   if (message.type === 'proxy-listening') {
-    startTest(message.port);
+    startTest(message.port).then(common.mustCall());
   } else if (message.type === 'proxy-stopped') {
     assert.deepStrictEqual(new Set(message.logs), expectedProxyLogs);
     // Close the server after the proxy is stopped.
     proxyWorker.terminate();
   }
-});
+}, 2));
 
 const requests = new Set();
 // Create a server that records the requests it gets.
@@ -74,7 +74,7 @@ async function startTest(proxyPort) {
         'proxy-connection': 'close',
       },
     });
-    http.request(url, (res) => {
+    http.request(url, common.mustCall((res) => {
       res.on('error', common.mustNotCall());
       res.setEncoding('utf8');
       res.on('data', () => {});
@@ -88,6 +88,6 @@ async function startTest(proxyPort) {
           proxyWorker.postMessage({ type: 'stop-proxy' });
         }
       }));
-    }).on('error', common.mustNotCall()).end();
+    })).on('error', common.mustNotCall()).end();
   }
 }

filename: test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs
patch: @@ -67,7 +67,7 @@ for (const testCase of testCases) {
     url: severHost,
     headers: { host: severHost },
   });
-  https.request(url, (res) => {
+  https.request(url, common.mustCall((res) => {
     res.on('error', common.mustNotCall());
     res.setEncoding('utf8');
     res.on('data', (data) => {
@@ -77,14 +77,14 @@ for (const testCase of testCases) {
       console.log(`[Proxy client] #${++counter} closed request for: ${inspect(url)}`);
       // Finished all test cases.
       if (counter === testCases.length) {
-        setImmediate(() => {
+        setImmediate(common.mustCall(() => {
           console.log('All requests completed, shutting down.');
           proxy.close();
           server.close();
           assert.deepStrictEqual(requests, expectedUrls);
           assert.deepStrictEqual(new Set(logs), expectedProxyLogs);
-        });
+        }));
       }
     }));
-  }).on('error', common.mustNotCall()).end();
+  })).on('error', common.mustNotCall()).end();
 }

filename: test/eslint.config_partial.mjs
patch: @@ -156,7 +156,7 @@ export default [
   },
   {
     files: [
-      'test/{async-hooks,message,module-hooks,node-api,pummel,pseudo-tty,v8-updates,wasi}/**/*.{js,mjs,cjs}',
+      'test/{async-hooks,benchmark,cctest,client-proxy,message,module-hooks,node-api,pummel,pseudo-tty,v8-updates,wasi}/**/*.{js,mjs,cjs}',
     ],
     rules: {
       'node-core/must-call-assert': 'error',