diff --git a/test/parallel/test-async-wrap-constructor.js b/test/parallel/test-async-wrap-constructor.js index 8e96e9ce3021ef..e89bc49df02333 100644 --- a/test/parallel/test-async-wrap-constructor.js +++ b/test/parallel/test-async-wrap-constructor.js @@ -6,14 +6,15 @@ require('../common'); const assert = require('assert'); const async_hooks = require('async_hooks'); -for (const badArg of [0, 1, false, true, null, 'hello']) { +[0, 1, false, true, null, 'hello'].forEach((badArg) => { const hookNames = ['init', 'before', 'after', 'destroy', 'promiseResolve']; - for (const field of hookNames) { + hookNames.forEach((field) => { assert.throws(() => { async_hooks.createHook({ [field]: badArg }); }, { code: 'ERR_ASYNC_CALLBACK', name: 'TypeError', + message: `hook.${field} must be a function` }); - } -} + }); +});