Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Port the make_callback test addon from #219 and enable node-api/test_async in node-tests

未關閉
#403 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
55/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
c, cmake, javascript, node.js, typescript

研究方向

從 packages/node-addon-examples/src/index.ts、tests/async 的 CMake 範本、scripts/copy-tests.mts 和 packages/node-tests/common.ts 開始;比較 #219 中的 make_callback 檔案與 #398 中的 threadsafe-function addon。執行儲存庫的 node-addon-examples 和 node-tests 檢查。完成的標準是 addon 已建置並註冊、node-api/test_async 已啟用,而且兩條測試路徑都通過。

由索引模型根據 Issue 內容生成。

描述

Two test-coverage follow-ups deferred from #398. Both validate functionality that Hermes' first-party Node-API implementation provides on its own (independent of the hermes_napi_host integration), so they were split out as test-infrastructure work.

1. Port the make_callback test addon from #219

napi_async_init / napi_async_destroy / napi_make_callback are provided natively by the vendored Hermes since the static_h adoption (the injector binds the full symbol surface), which obsoletes #219's host-side C++ implementation — but its test addon (tests/make_callback/: addon.c adapted from Node's own test plus a promise-less driver asserting receiver/argument/return-value plumbing) ports directly to the packages/node-addon-examples/tests/<name>/ pattern established there and in #398:

  • Copy addon.c, addon.js, binding.gyp from #219 (credit @paradowstack), add the checked-in CMakeLists.txt per the tests/async template and a package.json with a unique name (e.g. make-callback-test).
  • Register under suites.tests in packages/node-addon-examples/src/index.ts.

Expected to pass as-is against next — a failure would be a real conformance finding against Hermes' implementation.

2. Enable node-api/test_async in packages/node-tests

The entry exists but is commented out in scripts/copy-tests.mts's ALLOW_LIST. Two independent blockers:

  • common shims: the bundling pipeline aliases ../../common to packages/node-tests/common.ts, which currently only exports buildType. Upstream test.js uses common.mustCall. A faithful mustCall/mustCallAtLeast/mustNotCall needs a home for its verification step: upstream checks call counts at process exit, which has no analogue in the long-lived mocha-remote app — the shim needs a per-test verification hook wired into the generated suite (e.g. an afterEach-style flush exposed from common.ts).
  • <uv.h> in the C side: upstream test_async.c includes <uv.h> directly, so enabling it also needs a small uv shim along the lines of the pthread-based one written for tests/threadsafe-function/addon.c in #398 (or an upstream contribution making the test buildable without libuv).

Note on value: the behavioral coverage largely overlaps the hand-written tests/async addon (create/queue/cancel/delete, cancel-while-queued via pool saturation — upstream's MAX_CANCEL_THREADS 6 trick is the same one tests/async already uses — plus the #398 additions for thread identity and cancel-while-running). The win from enabling the upstream suite is conformance tracking against Node itself rather than new coverage, which is also why it wasn't a blocker for #398.

主要語言
TypeScript
星號
188
分支
10
平均合併
2 天 17 小時
30 天內合併 PR
3

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

callstackincubator/react-native-node-api 的其他 Issue

查看 callstackincubator/react-native-node-api 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。