diff --git a/src/node.cc b/src/node.cc index 55e5ad3dd71a75..def2b6148776aa 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3368,6 +3368,12 @@ void SetupProcessObject(Environment* env, "nghttp2", FIXED_ONE_BYTE_STRING(env->isolate(), NGHTTP2_VERSION)); + const char node_napi_version[] = NODE_STRINGIFY(NAPI_VERSION); + READONLY_PROPERTY( + versions, + "napi", + FIXED_ONE_BYTE_STRING(env->isolate(), node_napi_version)); + // process._promiseRejectEvent Local promiseRejectEvent = Object::New(env->isolate()); READONLY_DONT_ENUM_PROPERTY(process, diff --git a/src/node_api.cc b/src/node_api.cc index 095f98f64f4e77..2101fcba020d95 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -18,8 +18,6 @@ #include "node_api.h" #include "node_internals.h" -#define NAPI_VERSION 2 - static napi_status napi_set_last_error(napi_env env, napi_status error_code, uint32_t engine_error_code = 0, diff --git a/src/node_version.h b/src/node_version.h index aa271549247d15..7e7a164bf9bc7b 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -108,4 +108,7 @@ */ #define NODE_MODULE_VERSION 59 +// the NAPI_VERSION provided by this version of the runtime +#define NAPI_VERSION 2 + #endif // SRC_NODE_VERSION_H_ diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 5644ac4658b534..8f706c6954cd2c 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -3,7 +3,7 @@ const common = require('../common'); const assert = require('assert'); const expected_keys = ['ares', 'http_parser', 'modules', 'node', - 'uv', 'v8', 'zlib', 'nghttp2']; + 'uv', 'v8', 'zlib', 'nghttp2', 'napi']; if (common.hasCrypto) { expected_keys.push('openssl');