Skip to content

Commit ef96fde

Browse files
synapseaduh95
andauthored
Update lib/assert.js
Co-authored-by: Antoine du Hamel <[email protected]>
1 parent 4991363 commit ef96fde

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/assert.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,10 +662,11 @@ function compareBranch(
662662
}
663663

664664
// Check for Set object equality
665-
if (actual instanceof Set && expected instanceof Set) {
665+
if (isSet(actual) && isSet(expected)) {
666666
if (actual.size !== expected.size) return false;
667-
for (const item of actual) {
668-
if (!expected.has(item)) return false;
667+
const safeIterator = FunctionPrototypeCall(SafeSet.prototype[SymbolIterator], actual);
668+
for (const item of safeIterator) {
669+
if (!SetPrototypeHas(expected, item)) return false;
669670
}
670671
return true;
671672
}

0 commit comments

Comments
 (0)