From c5cc1b682e88e499045d3ad68a7f78e89b257afa Mon Sep 17 00:00:00 2001 From: Chand Date: Fri, 22 Sep 2023 18:56:57 -0400 Subject: [PATCH 1/2] test: replace forEach() with for loop test: Replace foreach loop with for in test-trace-events-http.js --- test/parallel/test-trace-events-http.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-trace-events-http.js b/test/parallel/test-trace-events-http.js index bcdc897e2ff136..57a813d4ed4eb2 100644 --- a/test/parallel/test-trace-events-http.js +++ b/test/parallel/test-trace-events-http.js @@ -31,12 +31,11 @@ proc.once('exit', common.mustCall(() => { const traces = JSON.parse(data.toString()).traceEvents; assert(traces.length > 0); let count = 0; - traces.forEach((trace) => { - if (trace.cat === 'node,node.http' && - ['http.server.request', 'http.client.request'].includes(trace.name)) { + for (const trace of traces) { + if (trace.cat === 'node,node.http' && ['http.server.request', 'http.client.request'].includes(trace.name)) { count++; } - }); + } // Two begin, two end assert.strictEqual(count, 4); })); From 1a0f8aacccaa30a3d8266a51214d4731cbb08a91 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Thu, 2 Nov 2023 09:04:22 +0100 Subject: [PATCH 2/2] Update test/parallel/test-trace-events-http.js --- test/parallel/test-trace-events-http.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-trace-events-http.js b/test/parallel/test-trace-events-http.js index 57a813d4ed4eb2..07a6b28fa5b273 100644 --- a/test/parallel/test-trace-events-http.js +++ b/test/parallel/test-trace-events-http.js @@ -32,7 +32,8 @@ proc.once('exit', common.mustCall(() => { assert(traces.length > 0); let count = 0; for (const trace of traces) { - if (trace.cat === 'node,node.http' && ['http.server.request', 'http.client.request'].includes(trace.name)) { + if (trace.cat === 'node,node.http' && + ['http.server.request', 'http.client.request'].includes(trace.name)) { count++; } }