Skip to content

Commit f5bf9fd

Browse files
anbaMs2ger
authored andcommitted
Allow for implementation-defined Error properties
Various implementations (JSC, V8, SM) define additional properties on Error instances. Adjust the test case to account for that.
1 parent ce7e72d commit f5bf9fd

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/built-ins/NativeErrors/SuppressedError/order-of-args-evaluation.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ const e = new SuppressedError(error, suppressed, message);
3131

3232
assert.sameValue(messageStringified, true);
3333
const keys = Object.getOwnPropertyNames(e);
34-
assert(keys.indexOf("message") === 0, "Expected 'message' to be defined first");
35-
assert(keys.indexOf("error") === 1, "Expected 'error' to be defined second");
36-
assert(keys.indexOf("suppressed") === 2, "Expected 'suppressed' to be defined third");
3734

35+
// Allow implementation-defined properties before "message" and after "suppressed".
36+
37+
const messageIndex = keys.indexOf("message");
38+
assert.notSameValue(messageIndex, -1, "Expected 'message' to be defined");
39+
40+
const errorIndex = keys.indexOf("error");
41+
assert.sameValue(errorIndex, messageIndex + 1, "Expected 'error' to be defined after 'message'");
42+
43+
const suppressedIndex = keys.indexOf("suppressed");
44+
assert.sameValue(suppressedIndex, errorIndex + 1, "Expected 'suppressed' to be defined after 'error'");

0 commit comments

Comments
 (0)