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
compare(), format(), serialize(), and diff() throw an error when called on objects which have own properties with no property descriptors. (As far as I know, the only such objects are Proxys.)
concordance assumes that, if Object.getOwnPropertyNames(input) returns e.g. ['name'], then Object.getOwnPropertyDescriptor(input, 'name') will return a property descriptor. This is true for non-Proxy inputs, but can be false for Proxys, which in most cases don't have to respect any relation between the ownKeys and ownPropertyDescriptor operations.
This can lead to throwing
TypeError {
message: 'Cannot read property \'enumerable\' of undefined',
}
I encountered this when I accidentally tried to snapshot a jsdom Window object, which apparently has some ownKeys that lack descriptors.
I'm not sure whether there's a better way to handle this. The "value" of the property can still be retrieved with e.g. Reflect.get(), so that could be used for comparison; but enumerability and other property attributes are strange.
As far as I can tell, undescribed properties do not behave identically to any valid property descriptor, nor to the absence of a property. They are not themselves listed in enumerations, but neither do they mask the presence of enumerable prototype properties, as truly unenumerable properties do. They may or may not satisfy Reflect.has(object, property).
The text was updated successfully, but these errors were encountered:
compare()
,format()
,serialize()
, anddiff()
throw an error when called on objects which have own properties with no property descriptors. (As far as I know, the only such objects areProxy
s.)concordance
assumes that, ifObject.getOwnPropertyNames(input)
returns e.g.['name']
, thenObject.getOwnPropertyDescriptor(input, 'name')
will return a property descriptor. This is true for non-Proxy
inputs, but can be false forProxy
s, which in most cases don't have to respect any relation between theownKeys
andownPropertyDescriptor
operations.This can lead to throwing
at
concordance/lib/getObjectKeys.js
Line 20 in b30e7c8
I encountered this when I accidentally tried to snapshot a jsdom Window object, which apparently has some ownKeys that lack descriptors.
I'm not sure whether there's a better way to handle this. The "value" of the property can still be retrieved with e.g.
Reflect.get()
, so that could be used for comparison; but enumerability and other property attributes are strange.As far as I can tell, undescribed properties do not behave identically to any valid property descriptor, nor to the absence of a property. They are not themselves listed in enumerations, but neither do they mask the presence of enumerable prototype properties, as truly unenumerable properties do. They may or may not satisfy
Reflect.has(object, property)
.The text was updated successfully, but these errors were encountered: