diff --git a/test/parallel/test-buffer-includes.js b/test/parallel/test-buffer-includes.js index 2b65ce41889cdc..5a0a89ba924f0c 100644 --- a/test/parallel/test-buffer-includes.js +++ b/test/parallel/test-buffer-includes.js @@ -273,15 +273,17 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) { } } -assert.throws(function() { - b.includes(function() { }); -}); -assert.throws(function() { +const expectedError = + /^TypeError: "val" argument must be string, number or Buffer$/; +assert.throws(() => { + b.includes(() => {}); +}, expectedError); +assert.throws(() => { b.includes({}); -}); -assert.throws(function() { +}, expectedError); +assert.throws(() => { b.includes([]); -}); +}, expectedError); // test truncation of Number arguments to uint8 {