From 9bfd84c117d4a20b8af0b2dd8b9156164aa154a9 Mon Sep 17 00:00:00 2001 From: Andrea Pavone Date: Sat, 18 Nov 2023 16:29:52 +0100 Subject: [PATCH] test: replace forEach with for of in test-trace-events-api.js PR-URL: https://github.com/nodejs/node/pull/50784 Reviewed-By: James M Snell Reviewed-By: Rafael Gonzaga Reviewed-By: Luigi Pinca --- test/parallel/test-trace-events-api.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-trace-events-api.js b/test/parallel/test-trace-events-api.js index 70520d7e30bbcb..709f8de9097906 100644 --- a/test/parallel/test-trace-events-api.js +++ b/test/parallel/test-trace-events-api.js @@ -31,7 +31,7 @@ const isChild = process.argv[2] === 'child'; const enabledCategories = getEnabledCategoriesFromCommandLine(); assert.strictEqual(getEnabledCategories(), enabledCategories); -[1, 'foo', true, false, null, undefined].forEach((i) => { +for (const i of [1, 'foo', true, false, null, undefined]) { assert.throws(() => createTracing(i), { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' @@ -40,7 +40,7 @@ assert.strictEqual(getEnabledCategories(), enabledCategories); code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); -}); +} assert.throws( () => createTracing({ categories: [] }), @@ -156,8 +156,7 @@ function testApiInChildProcess(execArgs, cb) { assert.strictEqual( traces.length, expectedBegins.length + expectedEnds.length); - - traces.forEach((trace) => { + for (const trace of traces) { assert.strictEqual(trace.pid, proc.pid); switch (trace.ph) { case 'b': { @@ -175,7 +174,7 @@ function testApiInChildProcess(execArgs, cb) { default: assert.fail('Unexpected trace event phase'); } - }); + } process.chdir(parentDir); cb && process.nextTick(cb); }));