nodejs / nodejs/node-api-cts

Split test_general into stable and experimental targets

未关闭
#34 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C
星标
18
派生
12
PR 合并指标
30 天内没有已合并 PR

描述

Problem

The upstream test_general test in the Node.js repository compiles a single target with NAPI_EXPERIMENTAL, which links against all experimental Node-API symbols (node_api_set_prototype, node_api_post_finalizer). This means the addon cannot be loaded on runtimes that don't export every experimental symbol.

In the CTS, this forces all test_general JS test files to guard loadAddon behind a check for every experimental feature the addon links against. The result is that even stable API tests (like napi_strict_equals, napi_typeof, napi_instanceof, etc.) are silently skipped on runtimes that don't support all experimental features.

Proposed solution

Split the upstream test_general into separate targets:

  1. Stable target — compiles without NAPI_EXPERIMENTAL, includes all stable API functions
  2. Experimental target(s) — one per experimental feature, compiled with the appropriate NAPI_EXPERIMENTAL define

This would allow the CTS to test stable APIs independently of experimental feature support.

Current workaround

The CTS ports test_general as a single experimental addon (matching upstream), with all JS tests guarded behind experimentalFeatures.setPrototype && experimentalFeatures.postFinalizer.

References

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 upstream test/js-native-api/test_general 目录及其 binding.gyp 开始,然后比较 CTS 当前如何移植单个 experimental target。确定 issue 中描述的 stable 和 experimental feature 分组。完成的标准是:stable API tests 可以在不加载所有 experimental symbols 的情况下加载,而 experimental tests 仍然单独受到 guard 保护并且可以 build。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, javascript, node.js
领域
api, build-system, testing-qa
Issue 类型
重构
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。