From 42c37f28e62aa858ef1611adcf1e77c3084b2a79 Mon Sep 17 00:00:00 2001 From: Tiffany Lastimosa Date: Fri, 6 Oct 2023 07:25:02 -0700 Subject: [PATCH] test: change forEach to for...of MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/49799 Reviewed-By: Tobias Nießen Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat --- test/parallel/test-assert.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 2e4097eb270263..3132c52504421d 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -476,7 +476,7 @@ assert.throws(() => { { // Bad args to AssertionError constructor should throw TypeError. const args = [1, true, false, '', null, Infinity, Symbol('test'), undefined]; - args.forEach((input) => { + for (const input of args) { assert.throws( () => new assert.AssertionError(input), { @@ -485,7 +485,7 @@ assert.throws(() => { message: 'The "options" argument must be of type object.' + common.invalidArgTypeHelper(input) }); - }); + } } assert.throws( @@ -965,11 +965,8 @@ assert.throws( } ); -[ - 1, - false, - Symbol(), -].forEach((input) => { +const inputs = [1, false, Symbol()]; +for (const input of inputs) { assert.throws( () => assert.throws(() => {}, input), { @@ -979,7 +976,7 @@ assert.throws( common.invalidArgTypeHelper(input) } ); -}); +} {