Skip to content

Commit 00cf091

Browse files
aduh95juanarbol
authored andcommitted
test: ensure assertions are reachable in test/client-proxy
PR-URL: #60175 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
1 parent fcaa074 commit 00cf091

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎test/client-proxy/test-http-proxy-request-invalid-char-in-url.mjs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import { Worker } from 'node:worker_threads';
1212
const expectedProxyLogs = new Set();
1313
const proxyWorker = new Worker(fixtures.path('proxy-server-worker.js'));
1414

15-
proxyWorker.on('message', (message) => {
15+
proxyWorker.on('message', common.mustCall((message) => {
1616
console.log('Received message from worker:', message.type);
1717
if (message.type === 'proxy-listening') {
18-
startTest(message.port);
18+
startTest(message.port).then(common.mustCall());
1919
} else if (message.type === 'proxy-stopped') {
2020
assert.deepStrictEqual(new Set(message.logs), expectedProxyLogs);
2121
// Close the server after the proxy is stopped.
2222
proxyWorker.terminate();
2323
}
24-
});
24+
}, 2));
2525

2626
const requests = new Set();
2727
// Create a server that records the requests it gets.
@@ -74,7 +74,7 @@ async function startTest(proxyPort) {
7474
'proxy-connection': 'close',
7575
},
7676
});
77-
http.request(url, (res) => {
77+
http.request(url, common.mustCall((res) => {
7878
res.on('error', common.mustNotCall());
7979
res.setEncoding('utf8');
8080
res.on('data', () => {});
@@ -88,6 +88,6 @@ async function startTest(proxyPort) {
8888
proxyWorker.postMessage({ type: 'stop-proxy' });
8989
}
9090
}));
91-
}).on('error', common.mustNotCall()).end();
91+
})).on('error', common.mustNotCall()).end();
9292
}
9393
}

‎test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ for (const testCase of testCases) {
6666
url: severHost,
6767
headers: { host: severHost },
6868
});
69-
https.request(url, (res) => {
69+
https.request(url, common.mustCall((res) => {
7070
res.on('error', common.mustNotCall());
7171
res.setEncoding('utf8');
7272
res.on('data', () => {});
@@ -80,5 +80,5 @@ for (const testCase of testCases) {
8080
assert.deepStrictEqual(new Set(logs), expectedProxyLogs);
8181
}
8282
}));
83-
}).on('error', common.mustNotCall()).end();
83+
})).on('error', common.mustNotCall()).end();
8484
}

‎test/eslint.config_partial.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export default [
154154
},
155155
{
156156
files: [
157-
'test/{async-hooks,message,module-hooks,node-api,pummel,pseudo-tty,v8-updates,wasi}/**/*.{js,mjs,cjs}',
157+
'test/{async-hooks,benchmark,cctest,client-proxy,message,module-hooks,node-api,pummel,pseudo-tty,v8-updates,wasi}/**/*.{js,mjs,cjs}',
158158
],
159159
rules: {
160160
'node-core/must-call-assert': 'error',

0 commit comments

Comments
 (0)