| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,16 +12,16 @@ import { Worker } from 'node:worker_threads'; | |||
| 12 | 12 | const expectedProxyLogs = new Set(); | |
| 13 | 13 | const proxyWorker = new Worker(fixtures.path('proxy-server-worker.js')); | |
| 14 | 14 | ||
| 15 | - proxyWorker.on('message', (message) => { | ||
| 15 | + proxyWorker.on('message', common.mustCall((message) => { | ||
| 16 | 16 | console.log('Received message from worker:', message.type); | |
| 17 | 17 | if (message.type === 'proxy-listening') { | |
| 18 | - startTest(message.port); | ||
| 18 | + startTest(message.port).then(common.mustCall()); | ||
| 19 | 19 | } else if (message.type === 'proxy-stopped') { | |
| 20 | 20 | assert.deepStrictEqual(new Set(message.logs), expectedProxyLogs); | |
| 21 | 21 | // Close the server after the proxy is stopped. | |
| 22 | 22 | proxyWorker.terminate(); | |
| 23 | 23 | } | |
| 24 | - }); | ||
| 24 | + }, 2)); | ||
| 25 | 25 | ||
| 26 | 26 | const requests = new Set(); | |
| 27 | 27 | // Create a server that records the requests it gets. | |
@@ -74,7 +74,7 @@ async function startTest(proxyPort) { | |||
| 74 | 74 | 'proxy-connection': 'close', | |
| 75 | 75 | }, | |
| 76 | 76 | }); | |
| 77 | - http.request(url, (res) => { | ||
| 77 | + http.request(url, common.mustCall((res) => { | ||
| 78 | 78 | res.on('error', common.mustNotCall()); | |
| 79 | 79 | res.setEncoding('utf8'); | |
| 80 | 80 | res.on('data', () => {}); | |
@@ -88,6 +88,6 @@ async function startTest(proxyPort) { | |||
| 88 | 88 | proxyWorker.postMessage({ type: 'stop-proxy' }); | |
| 89 | 89 | } | |
| 90 | 90 | })); | |
| 91 | - }).on('error', common.mustNotCall()).end(); | ||
| 91 | + })).on('error', common.mustNotCall()).end(); | ||
| 92 | 92 | } | |
| 93 | 93 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,7 +67,7 @@ for (const testCase of testCases) { | |||
| 67 | 67 | url: severHost, | |
| 68 | 68 | headers: { host: severHost }, | |
| 69 | 69 | }); | |
| 70 | - https.request(url, (res) => { | ||
| 70 | + https.request(url, common.mustCall((res) => { | ||
| 71 | 71 | res.on('error', common.mustNotCall()); | |
| 72 | 72 | res.setEncoding('utf8'); | |
| 73 | 73 | res.on('data', (data) => { | |
@@ -77,14 +77,14 @@ for (const testCase of testCases) { | |||
| 77 | 77 | console.log(`[Proxy client] #${++counter} closed request for: ${inspect(url)}`); | |
| 78 | 78 | // Finished all test cases. | |
| 79 | 79 | if (counter === testCases.length) { | |
| 80 | - setImmediate(() => { | ||
| 80 | + setImmediate(common.mustCall(() => { | ||
| 81 | 81 | console.log('All requests completed, shutting down.'); | |
| 82 | 82 | proxy.close(); | |
| 83 | 83 | server.close(); | |
| 84 | 84 | assert.deepStrictEqual(requests, expectedUrls); | |
| 85 | 85 | assert.deepStrictEqual(new Set(logs), expectedProxyLogs); | |
| 86 | - }); | ||
| 86 | + })); | ||
| 87 | 87 | } | |
| 88 | 88 | })); | |
| 89 | - }).on('error', common.mustNotCall()).end(); | ||
| 89 | + })).on('error', common.mustNotCall()).end(); | ||
| 90 | 90 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -156,7 +156,7 @@ export default [ | |||
| 156 | 156 | }, | |
| 157 | 157 | { | |
| 158 | 158 | files: [ | |
| 159 | - 'test/{async-hooks,message,module-hooks,node-api,pummel,pseudo-tty,v8-updates,wasi}/**/*.{js,mjs,cjs}', | ||
| 159 | + 'test/{async-hooks,benchmark,cctest,client-proxy,message,module-hooks,node-api,pummel,pseudo-tty,v8-updates,wasi}/**/*.{js,mjs,cjs}', | ||
| 160 | 160 | ], | |
| 161 | 161 | rules: { | |
| 162 | 162 | 'node-core/must-call-assert': 'error', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments