diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index a3e9ab2668..28b8847e56 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -13,10 +13,11 @@ crypto.DEFAULT_ENCODING = 'buffer'; // bump, we register a lot of exit listeners process.setMaxListeners(256); +const expectedErrorRegexp = /^TypeError: size must be a number >= 0$/; [crypto.randomBytes, crypto.pseudoRandomBytes].forEach(function(f) { [-1, undefined, null, false, true, {}, []].forEach(function(value) { - assert.throws(function() { f(value); }, TypeError); - assert.throws(function() { f(value, function() {}); }, TypeError); + assert.throws(function() { f(value); }, expectedErrorRegexp); + assert.throws(function() { f(value, function() {}); }, expectedErrorRegexp); }); [0, 1, 2, 4, 16, 256, 1024].forEach(function(len) {