Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd1a7ea

Browse filesBrowse files
NFoxleyMylesBorins
authored andcommitted
test: add regex to text-crypto-random
PR-URL: #10020 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 15226f5 commit cd1a7ea
Copy full SHA for cd1a7ea

File tree

Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-crypto-random.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-crypto-random.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ crypto.DEFAULT_ENCODING = 'buffer';
1313
// bump, we register a lot of exit listeners
1414
process.setMaxListeners(256);
1515

16+
const expectedErrorRegexp = /^TypeError: size must be a number >= 0$/;
1617
[crypto.randomBytes, crypto.pseudoRandomBytes].forEach(function(f) {
1718
[-1, undefined, null, false, true, {}, []].forEach(function(value) {
18-
assert.throws(function() { f(value); }, TypeError);
19-
assert.throws(function() { f(value, function() {}); }, TypeError);
19+
assert.throws(function() { f(value); }, expectedErrorRegexp);
20+
assert.throws(function() { f(value, function() {}); }, expectedErrorRegexp);
2021
});
2122

2223
[0, 1, 2, 4, 16, 256, 1024].forEach(function(len) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.