diff --git a/test/addons-napi/4_object_factory/binding.c b/test/addons-napi/4_object_factory/binding.c index dedfd288f7ec0f..38b8ec8e1cab48 100644 --- a/test/addons-napi/4_object_factory/binding.c +++ b/test/addons-napi/4_object_factory/binding.c @@ -16,7 +16,7 @@ napi_value CreateObject(napi_env env, napi_callback_info info) { napi_value Init(napi_env env, napi_value exports) { NAPI_CALL(env, - napi_create_function(env, "exports", CreateObject, NULL, &exports)); + napi_create_function(env, "exports", -1, CreateObject, NULL, &exports)); return exports; } diff --git a/test/addons-napi/5_function_factory/binding.c b/test/addons-napi/5_function_factory/binding.c index 95f12bfd151c0b..8cc41f6aac5c3d 100644 --- a/test/addons-napi/5_function_factory/binding.c +++ b/test/addons-napi/5_function_factory/binding.c @@ -16,7 +16,7 @@ napi_value CreateFunction(napi_env env, napi_callback_info info) { napi_value Init(napi_env env, napi_value exports) { NAPI_CALL(env, - napi_create_function(env, "exports", CreateFunction, NULL, &exports)); + napi_create_function(env, "exports", -1, CreateFunction, NULL, &exports)); return exports; } diff --git a/test/addons-napi/6_object_wrap/myobject.cc b/test/addons-napi/6_object_wrap/myobject.cc index 5dec35d33a771b..af706274375512 100644 --- a/test/addons-napi/6_object_wrap/myobject.cc +++ b/test/addons-napi/6_object_wrap/myobject.cc @@ -23,8 +23,7 @@ void MyObject::Init(napi_env env, napi_value exports) { napi_value cons; NAPI_CALL_RETURN_VOID(env, - napi_define_class(env, "MyObject", New, nullptr, 3, properties, &cons)); - napi_define_class(env, "MyObject", -1, New, nullptr, 3, properties, &cons)); + napi_define_class(env, "MyObject", -1, New, nullptr, 3, properties, &cons)); NAPI_CALL_RETURN_VOID(env, napi_create_reference(env, cons, 1, &constructor)); diff --git a/test/addons-napi/7_factory_wrap/binding.cc b/test/addons-napi/7_factory_wrap/binding.cc index 551bfef15dbc87..c8fca4d536e74c 100644 --- a/test/addons-napi/7_factory_wrap/binding.cc +++ b/test/addons-napi/7_factory_wrap/binding.cc @@ -16,7 +16,7 @@ napi_value Init(napi_env env, napi_value exports) { NAPI_CALL(env, MyObject::Init(env)); NAPI_CALL(env, - napi_create_function(env, "exports", CreateObject, NULL, &exports)); + napi_create_function(env, "exports", -1, CreateObject, NULL, &exports)); return exports; } diff --git a/test/addons-napi/test_constructor/test_constructor.c b/test/addons-napi/test_constructor/test_constructor.c index 759c2ea1903b24..526a19249c5736 100644 --- a/test/addons-napi/test_constructor/test_constructor.c +++ b/test/addons-napi/test_constructor/test_constructor.c @@ -78,7 +78,7 @@ napi_value Init(napi_env env, napi_value exports) { napi_value cons; NAPI_CALL_RETURN_VOID(env, napi_define_class(env, "MyObject", -1, New, - NULL, sizeof(properties)/sizeof(*properties), properties, &cons)); + NULL, sizeof(properties)/sizeof(*properties), properties, &cons)); NAPI_CALL(env, napi_create_reference(env, cons, 1, &constructor_)); diff --git a/test/addons-napi/test_constructor/test_constructor_name.c b/test/addons-napi/test_constructor/test_constructor_name.c index 0e61892ece260e..b178e80f49f489 100644 --- a/test/addons-napi/test_constructor/test_constructor_name.c +++ b/test/addons-napi/test_constructor/test_constructor_name.c @@ -10,16 +10,14 @@ napi_value New(napi_env env, napi_callback_info info) { return _this; } -void Init(napi_env env, napi_value exports, napi_value module, void* priv) { +napi_value Init(napi_env env, napi_value exports) { napi_value cons; - NAPI_CALL_RETURN_VOID(env, napi_define_class(env, "MyObject_Extra", 8, New, - NULL, 0, NULL, &cons)); + NAPI_CALL(env, napi_define_class( + env, "MyObject_Extra", 8, New, NULL, 0, NULL, &cons)); - NAPI_CALL_RETURN_VOID(env, - napi_set_named_property(env, module, "exports", cons)); - - NAPI_CALL_RETURN_VOID(env, - napi_create_reference(env, cons, 1, &constructor_)); + NAPI_CALL(env, + napi_create_reference(env, cons, 1, &constructor_)); + return cons; } NAPI_MODULE(addon, Init) diff --git a/test/addons-napi/test_env_sharing/compare_env.c b/test/addons-napi/test_env_sharing/compare_env.c index b7e789ac499317..da984b68f53f3e 100644 --- a/test/addons-napi/test_env_sharing/compare_env.c +++ b/test/addons-napi/test_env_sharing/compare_env.c @@ -15,7 +15,7 @@ napi_value compare(napi_env env, napi_callback_info info) { } napi_value Init(napi_env env, napi_value exports) { - NAPI_CALL(env, napi_create_function(env, "exports", compare, NULL, &exports)); + NAPI_CALL(env, napi_create_function(env, "exports", -1, compare, NULL, &exports)); return exports; } diff --git a/test/addons-napi/test_function/test.js b/test/addons-napi/test_function/test.js index e18a5ff45e504e..752e9965b23039 100644 --- a/test/addons-napi/test_function/test.js +++ b/test/addons-napi/test_function/test.js @@ -26,5 +26,6 @@ function func4(input) { return func3(input); } assert.strictEqual(test_function.TestCall(func4, 1), 2); + assert.strictEqual(test_function.TestName.name, 'Name'); assert.strictEqual(test_function.TestNameShort.name, 'Name_');