Skip to content

Commit 7b9b1fb

Browse files
bliakherUlisesGascon
authored andcommitted
test: replace forEach() with for .. of
PR-URL: #50605 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 9397b2d commit 7b9b1fb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/parallel/test-async-wrap-constructor.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ require('../common');
66
const assert = require('assert');
77
const async_hooks = require('async_hooks');
88

9-
[0, 1, false, true, null, 'hello'].forEach((badArg) => {
9+
const falsyValues = [0, 1, false, true, null, 'hello'];
10+
for (const badArg of falsyValues) {
1011
const hookNames = ['init', 'before', 'after', 'destroy', 'promiseResolve'];
11-
hookNames.forEach((field) => {
12+
for (const hookName of hookNames) {
1213
assert.throws(() => {
13-
async_hooks.createHook({ [field]: badArg });
14+
async_hooks.createHook({ [hookName]: badArg });
1415
}, {
1516
code: 'ERR_ASYNC_CALLBACK',
1617
name: 'TypeError',
17-
message: `hook.${field} must be a function`
18+
message: `hook.${hookName} must be a function`
1819
});
19-
});
20-
});
20+
}
21+
}

0 commit comments

Comments
 (0)