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: make url-util-format engine agnostic · nodejs/node@9c3a7bf

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-util-format.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-util-format.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-util-format.js
+12-3Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,18 @@ assert.strictEqual(util.format(symbol), 'Symbol(foo)');
4444
assert.strictEqual(util.format('foo', symbol), 'foo Symbol(foo)');
4545
assert.strictEqual(util.format('%s', symbol), 'Symbol(foo)');
4646
assert.strictEqual(util.format('%j', symbol), 'undefined');
47-
assert.throws(function() {
48-
util.format('%d', symbol);
49-
}, /^TypeError: Cannot convert a Symbol value to a number$/);
47+
assert.throws(
48+
() => { util.format('%d', symbol); },
49+
(e) => {
50+
// The error should be a TypeError.
51+
if (!(e instanceof TypeError))
52+
return false;
53+
54+
// The error should be from the JS engine and not from Node.js.
55+
// JS engine errors do not have the `code` property.
56+
return e.code === undefined;
57+
}
58+
);
5059

5160
// Number format specifier
5261
assert.strictEqual(util.format('%d'), '%d');

0 commit comments

Comments
0 (0)
You are visitor 01402775 — 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.