GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: add regex to text-crypto-random · nodejs/node@cd1a7ea

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-crypto-random.js
Expand file treeCollapse file tree
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)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.