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 591a692

Browse filesBrowse files
Trottevanlucas
authored andcommitted
test: make test-querystring-escape engine agnostic
Do not check the error message if it is generated by the JavaScript engine (V8, ChakraCore, etc.). Do confirm that it is a `TypeError`. PR-URL: #16272 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent e2f5648 commit 591a692
Copy full SHA for 591a692

File tree

Expand file treeCollapse file tree

1 file changed

+8
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-6
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-querystring-escape.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-querystring-escape.js
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ assert.strictEqual(
2828
'test'
2929
);
3030

31-
// toString is not callable, must throw an error
32-
assert.throws(() => qs.escape({ toString: 5 }),
33-
/^TypeError: Cannot convert object to primitive value$/);
31+
// `toString` is not callable, must throw an error.
32+
// Error message will vary between different JavaScript engines, so only check
33+
// that it is a `TypeError`.
34+
assert.throws(() => qs.escape({ toString: 5 }), TypeError);
3435

35-
// should use valueOf instead of non-callable toString
36+
// Should use valueOf instead of non-callable toString.
3637
assert.strictEqual(qs.escape({ toString: 5, valueOf: () => 'test' }), 'test');
3738

38-
assert.throws(() => qs.escape(Symbol('test')),
39-
/^TypeError: Cannot convert a Symbol value to a string$/);
39+
// Error message will vary between different JavaScript engines, so only check
40+
// that it is a `TypeError`.
41+
assert.throws(() => qs.escape(Symbol('test')), TypeError);

0 commit comments

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