You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
Serializing a fragment causes side effect enumerable symbol Symbol(SameObject caches)
When you commented out toMatchDiffSnapshot then both fragment instances have no enumerable properties, so test passes as false negative, even if I comment out span2.innerHTML = 'hello' to compare <span>hello</span> to <span>huh</span>
With toMatchDiffSnapshot then first has been serialized, so has bogus implementation symbol key, but because of reassignment to second the new instance has no keys
To confirm, if I call pretty-format with DOMElement plugin to serialize the second instance, then toEqual passes as false negative, because both have value of SameObject caches
@SimenB /cc @thymikee The regression is caused by 2 bugs in
jsdompackage:In Check for existence of
Elementwhen comparing DOM-nody-things (#7786) (clean cherry pick version) jestjs/jest#7995 we changedisDomNodefunction injasmineUtils.tsfile:obj !== null && typeof obj === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string'instanceoftest:typeof Node !== 'undefined' && obj instanceof NodeSerializing a fragment causes side effect enumerable symbol
Symbol(SameObject caches)When you commented out
toMatchDiffSnapshotthen both fragment instances have no enumerable properties, so test passes as false negative, even if I comment outspan2.innerHTML = 'hello'to compare<span>hello</span>to<span>huh</span>With
toMatchDiffSnapshotthenfirsthas been serialized, so has bogus implementation symbol key, but because of reassignment tosecondthe new instance has no keysTo confirm, if I call
pretty-formatwithDOMElementplugin to serialize thesecondinstance, thentoEqualpasses as false negative, because both have value ofSameObject caches