Skip to content

Commit 591a692

Browse 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 <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent e2f5648 commit 591a692

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/parallel/test-querystring-escape.js

+8-6
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)