Constconst obj = { visible: 'value' };
Object.defineProperty(obj, 'hidden', {
  value: 'secret',
  enumerable: false,
});
expect('visible', 'to be an enumerable property of', obj); // ✓ passes
expect('hidden', 'to be an enumerable property of', obj); // ✗ fails - not enumerable
expect('toString', 'to be an enumerable property of', obj); // ✗ fails - inherited property
Asserts that a given property key is an enumerable property of the target object.
This checks the
enumerabledescriptor property usingObject.getOwnPropertyDescriptor(). Only own properties (not inherited ones) are considered, and the property must be enumerable (i.e., would appear infor...inloops andObject.keys()results).