From b4ef06267d97eca0bfd734cf3be0ae31267b1716 Mon Sep 17 00:00:00 2001 From: Daniel Estiven Rico Posada Date: Thu, 2 Apr 2020 21:54:56 -0500 Subject: [PATCH] test: test-async-wrap-constructor prefer forEach MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/32631 Reviewed-By: Juan José Arboleda Reviewed-By: Anna Henningsen --- test/parallel/test-async-wrap-constructor.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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` }); - } -} + }); +});