node/test/node-api
Gabriel Schulhof ad3ebed046 node-api: allow retrieval of add-on file name
Unlike JS-only modules, native add-ons are always associated with a
dynamic shared object from which they are loaded. Being able to
retrieve its absolute path is important to native-only add-ons, i.e.
add-ons that are not themselves being loaded from a JS-only module
located in the same package as the native add-on itself.

Currently, the file name is obtained at environment construction time
from the JS `module.filename`. Nevertheless, the presence of `module`
is not required, because the file name could also be passed in via a
private property added onto `exports` from the `process.dlopen`
binding.

As an attempt at future-proofing, the file name is provided as a URL,
i.e. prefixed with the `file://` protocol.

Fixes: https://github.com/nodejs/node-addon-api/issues/449
PR-URL: https://github.com/nodejs/node/pull/37195
Co-authored-by: Michael Dawson <mdawson@devrus.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2021-02-09 23:34:30 -08:00
..
1_hello_world test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_async test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_async_cleanup_hook n-api: re-implement async env cleanup hooks 2020-08-27 08:18:37 -07:00
test_async_context test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_buffer test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_callback_scope test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_cleanup_hook test: convert most N-API tests from C++ to C 2020-08-05 14:21:51 -07:00
test_exception test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_fatal test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_fatal_exception test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_general node-api: allow retrieval of add-on file name 2021-02-09 23:34:30 -08:00
test_instance_data test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_make_callback test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_make_callback_recurse test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_null_init
test_policy test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_threadsafe_function test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_uv_loop test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_worker_buffer_callback test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_worker_terminate test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
test_worker_terminate_finalization test: rename n-api to node-api 2021-02-06 05:03:38 -08:00
.gitignore
node-api.status
testcfg.py