From e6123a1d786989d2180a59e34c160cbd2280c50b Mon Sep 17 00:00:00 2001 From: tifflastimosa Date: Fri, 22 Sep 2023 16:08:12 -0700 Subject: [PATCH 1/2] test: change forEach to for...of --- test/parallel/test-assert.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 2e4097eb270263..1d00d36b1d5f95 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -476,16 +476,16 @@ 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), { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', message: 'The "options" argument must be of type object.' + - common.invalidArgTypeHelper(input) + 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) } ); -}); +} { From e097d4a79e3c01b6325c3a9ee38e67e8adc86b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sun, 24 Sep 2023 14:14:16 +0200 Subject: [PATCH 2/2] Update test/parallel/test-assert.js --- test/parallel/test-assert.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 1d00d36b1d5f95..3132c52504421d 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -483,7 +483,7 @@ assert.throws(() => { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', message: 'The "options" argument must be of type object.' + - common.invalidArgTypeHelper(input) + common.invalidArgTypeHelper(input) }); } }