feat: port 6_object_wrap test to CTS#32
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
d57e9e9 to
d833299
Compare
|
CI fails on Node.js v20 — same root cause as #28. The Blocked on #37 (dropping Node v20 from CI). |
|
We can use the |
Port all three build targets and test files from upstream: - myobject (stable) — object wrap with getters/setters/methods - myobject_basic_finalizer (experimental) — basic finalizer verification - nested_wrap (NAPI_VERSION=10) — nested ref finalization The experimental target (myobject_basic_finalizer) exercises the add_node_api_cts_experimental_addon() CMake function for the first time, serving as end-to-end validation of the experimental infrastructure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d833299 to
b3d558f
Compare
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
use the napiVersion and skipTest primitives for porting test_6_object_wrap
| assert.strictEqual(obj, null); | ||
| })(); | ||
|
|
||
| await gcUntil('basic-finalizer', () => addon.getFinalizerCallCount() === 1); |
There was a problem hiding this comment.
It's interesting to see why the original test is asserting the finalizerCallCount again!
assert.strictEqual(addon.getFinalizerCallCount(), 1);
There was a problem hiding this comment.
I agree - that's curious 🤔 Perhaps the git history tells a story? I'd be okay with deleting that in a follow-up PR once we start refactoring these tests.
There was a problem hiding this comment.
I think we should keep it. It's to handle the case where the gcUntil loop finishes without satisfying the condition addon.getFinalizerCallCount() === 1.
There was a problem hiding this comment.
the assertion should fail in that case.
| assert.strictEqual(obj, null); | ||
| })(); | ||
|
|
||
| await gcUntil('basic-finalizer', () => addon.getFinalizerCallCount() === 1); |
There was a problem hiding this comment.
I think we should keep it. It's to handle the case where the gcUntil loop finishes without satisfying the condition addon.getFinalizerCallCount() === 1.
Summary
Ports
6_object_wrapfrom the Node.js test suite into the CTS. This is the first test to exercise the experimental addon infrastructure (add_node_api_cts_experimental_addon()), serving as end-to-end validation of #31.Three build targets:
myobject(stable) — object wrap with getters/setters,plusOne,multiplymyobject_basic_finalizer(experimental,NAPI_EXPERIMENTAL) — basic finalizer verification, guarded byexperimentalFeatures.postFinalizernested_wrap(NAPI_VERSION=10) — nested napi_ref finalizationThree JS test files:
test.js— property descriptors, constructor/plain-function invocation, method chainingtest-basic-finalizer.js— experimental finalizer withgcUntil, behind feature guardnested_wrap.js— nested wrap finalization withgcUntilAll C++ source files are copied verbatim from upstream.
Test plan
npm run addons:configure && npm run addons:build— all three targets compilenpm run node:test— all 58 tests pass (3 new)🤖 Generated with Claude Code