Skip to content

ObjectWrap: enumerable properties seem to be broken #644

Closed
@gms1

Description

@gms1

in 'test/objectwrap.cc' the property 'testGetter' is defined as enumerable:

InstanceAccessor("testGetter", &Test::Getter, nullptr, napi_enumerable),

but testing if this property is enumerable:

gms@orion:~/work/RESEARCH/node-addon-api (master *)$ git diff
diff --git a/test/objectwrap.js b/test/objectwrap.js
index de16a60..e5d3efc 100644
--- a/test/objectwrap.js
+++ b/test/objectwrap.js
@@ -11,6 +11,10 @@ const test = (binding) => {
   };
 
   const testAccessor = (obj, clazz) => {
+    // enumerable
+    {
+      assert.strictEqual(obj.propertyIsEnumerable('testGetter'), true);
+    }
     // read-only, write-only
     {
       obj.testSetter = 'instance getter';

fails with:

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

false !== true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions