Skip to content

feat: port test_cannot_run_js to CTS#1

Closed
kraenhansen wants to merge 2 commits intofeat/easy-js-native-api-testsfrom
feat/port-test-cannot-run-js
Closed

feat: port test_cannot_run_js to CTS#1
kraenhansen wants to merge 2 commits intofeat/easy-js-native-api-testsfrom
feat/port-test-cannot-run-js

Conversation

@kraenhansen
Copy link
Owner

Note

This PR is stacked on nodejs#25 and should not be reviewed or merged until that PR lands.

Summary

  • Ports test_cannot_run_js from node/test/js-native-api/ to the CTS
  • Builds two addons from the same C source (test_cannot_run_js with NAPI_VERSION=10, test_pending_exception with NAPI_VERSION=9) to cover both code paths in the finalizer
  • Verifies that when a finalizer tries to access JS during environment shutdown, napi_get_named_property returns napi_cannot_run_js (v10+), napi_pending_exception (v9), or napi_ok if the event loop is still running

Test plan

  • npm run addons:configure && npm run addons:build — both addons compile cleanly
  • npm run node:test — all 48 tests pass, including test_cannot_run_js

🤖 Generated with Claude Code

kraenhansen and others added 2 commits March 1, 2026 09:36
Builds two addons from the same C source with different NAPI_VERSION
defines (10 and 9) to verify that finalizers attempting to access JS
during shutdown receive napi_cannot_run_js or napi_pending_exception
(respectively), or napi_ok if the event loop is still running.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kraenhansen
Copy link
Owner Author

Closing in favour of a PR against the upstream nodejs/node-api-cts repo.

@kraenhansen kraenhansen closed this Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant