Skip to content

Commit

Permalink
test: replace forEach with for of in test-trace-events-api.js
Browse files Browse the repository at this point in the history
PR-URL: #50784
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
andp97 authored and richardlau committed Mar 25, 2024
1 parent 721557c commit 8ac05cf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/parallel/test-trace-events-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -40,7 +40,7 @@ assert.strictEqual(getEnabledCategories(), enabledCategories);
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError'
});
});
}

assert.throws(
() => createTracing({ categories: [] }),
Expand Down Expand Up @@ -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': {
Expand All @@ -175,7 +174,7 @@ function testApiInChildProcess(execArgs, cb) {
default:
assert.fail('Unexpected trace event phase');
}
});
}
process.chdir(parentDir);
cb && process.nextTick(cb);
}));
Expand Down

0 comments on commit 8ac05cf

Please sign in to comment.