Skip to content

Commit b94b20b

Browse files
committed
Skip Symbol.toStringTag tests if unsupported
1 parent c966391 commit b94b20b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

test/common/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors
77
const isBrowser = typeof window !== 'undefined';
88

99
const bigIntSupported = typeof BigInt !== 'undefined';
10+
const symbolSupported = typeof Symbol !== 'undefined';
11+
const symbolToStringTagSupported = symbolSupported && typeof Symbol.toStringTag !== 'undefined';
1012

1113
const noop = () => {};
1214

@@ -234,6 +236,7 @@ module.exports = {
234236
getOwnPropertyDescriptors,
235237
isBrowser,
236238
bigIntSupported,
239+
symbolToStringTagSupported,
237240
mustNotCall,
238241
mustCall,
239242
expectWarning,

test/parallel/test-assert-deep.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ assert.throws(
10121012
}
10131013

10141014
// Verify that extra keys will be tested for when using fake arrays.
1015-
{
1015+
if (common.symbolToStringTagSupported) {
10161016
const a = {
10171017
0: 1,
10181018
1: 1,
@@ -1029,7 +1029,7 @@ assert.throws(
10291029
}
10301030

10311031
// Verify that changed tags will still check for the error message.
1032-
{
1032+
if (common.symbolToStringTagSupported) {
10331033
const err = new Error('foo');
10341034
err[Symbol.toStringTag] = 'Foobar';
10351035
const err2 = new Error('bar');
@@ -1038,7 +1038,7 @@ assert.throws(
10381038
}
10391039

10401040
// Check for non-native errors.
1041-
{
1041+
if (common.symbolToStringTagSupported) {
10421042
const source = new Error('abc');
10431043
const err = Object.create(
10441044
Object.getPrototypeOf(source), common.getOwnPropertyDescriptors(source));

0 commit comments

Comments
 (0)