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 <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Andrea Pavone authored and James M Snell committed 2023-12-21 17:10:06 -08:00
1 parent 5155238064
commit ea41c63670
1 file changed
+4 -5
+4 -5
View File
@@ -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);
}));