Skip to content

Commit 126f092

Browse files
kraenhansenclaude
andcommitted
doc: add porting plan with difficulty ratings
Enumerates all 58 test directories from Node.js's test/js-native-api and test/node-api, rates each by porting difficulty (Easy/Medium/Hard), and documents special considerations for tests with deep runtime dependencies (libuv, worker threads, SEA, node_api_post_finalizer, etc.). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ebd91a5 commit 126f092

1 file changed

Lines changed: 69 additions & 67 deletions

File tree

PORTING.md

Lines changed: 69 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -23,87 +23,88 @@ in `js_native_api.h` and is therefore engine-agnostic.
2323
## Difficulty Ratings
2424

2525
Difficulty is assessed on two axes:
26+
2627
- **Size/complexity** — total lines of C/C++ and JS across all source files
2728
- **Runtime-API dependence** — pure `js_native_api.h` is cheapest; Node.js extensions and direct
2829
libuv calls require harness work or Node-only scoping
2930

30-
| Rating | Meaning |
31-
|---|---|
32-
| Easy | Small test, pure `js_native_api.h` or trivial runtime API, straightforward 1:1 port |
33-
| Medium | Moderate size or uses a Node.js extension API that the harness will need to abstract |
34-
| Hard | Large test and/or deep libuv/worker/SEA dependency; may need new harness primitives or Node-only scoping |
31+
| Rating | Meaning |
32+
| ------ | -------------------------------------------------------------------------------------------------------- |
33+
| Easy | Small test, pure `js_native_api.h` or trivial runtime API, straightforward 1:1 port |
34+
| Medium | Moderate size or uses a Node.js extension API that the harness will need to abstract |
35+
| Hard | Large test and/or deep libuv/worker/SEA dependency; may need new harness primitives or Node-only scoping |
3536

3637
## Engine-specific (`js-native-api`)
3738

3839
Tests covering the engine-specific part of Node-API, defined in `js_native_api.h`.
3940

40-
| Directory | Status | Difficulty |
41-
|---|---|---|
42-
| `2_function_arguments` | Ported ||
43-
| `3_callbacks` | Not ported | Easy |
44-
| `4_object_factory` | Not ported | Easy |
45-
| `5_function_factory` | Not ported | Easy |
46-
| `6_object_wrap` | Not ported | Medium |
47-
| `7_factory_wrap` | Not ported | Easy |
48-
| `8_passing_wrapped` | Not ported | Easy |
49-
| `test_array` | Not ported | Easy |
50-
| `test_bigint` | Not ported | Easy |
51-
| `test_cannot_run_js` | Not ported | Medium |
52-
| `test_constructor` | Not ported | Medium |
53-
| `test_conversions` | Not ported | Medium |
54-
| `test_dataview` | Not ported | Easy |
55-
| `test_date` | Not ported | Easy |
56-
| `test_error` | Not ported | Medium |
57-
| `test_exception` | Not ported | Medium |
58-
| `test_finalizer` | Not ported | Medium |
59-
| `test_function` | Not ported | Medium |
60-
| `test_general` | Not ported | Hard |
61-
| `test_handle_scope` | Not ported | Easy |
62-
| `test_instance_data` | Not ported | Easy |
63-
| `test_new_target` | Not ported | Easy |
64-
| `test_number` | Not ported | Easy |
65-
| `test_object` | Not ported | Hard |
66-
| `test_promise` | Not ported | Easy |
67-
| `test_properties` | Not ported | Easy |
68-
| `test_reference` | Not ported | Medium |
69-
| `test_reference_double_free` | Not ported | Easy |
70-
| `test_sharedarraybuffer` | Not ported | Medium |
71-
| `test_string` | Not ported | Medium |
72-
| `test_symbol` | Not ported | Easy |
73-
| `test_typedarray` | Not ported | Medium |
41+
| Directory | Status | Difficulty |
42+
| ---------------------------- | ---------- | ---------- |
43+
| `2_function_arguments` | Ported | |
44+
| `3_callbacks` | Not ported | Easy |
45+
| `4_object_factory` | Not ported | Easy |
46+
| `5_function_factory` | Not ported | Easy |
47+
| `6_object_wrap` | Not ported | Medium |
48+
| `7_factory_wrap` | Not ported | Easy |
49+
| `8_passing_wrapped` | Not ported | Easy |
50+
| `test_array` | Not ported | Easy |
51+
| `test_bigint` | Not ported | Easy |
52+
| `test_cannot_run_js` | Not ported | Medium |
53+
| `test_constructor` | Not ported | Medium |
54+
| `test_conversions` | Not ported | Medium |
55+
| `test_dataview` | Not ported | Easy |
56+
| `test_date` | Not ported | Easy |
57+
| `test_error` | Not ported | Medium |
58+
| `test_exception` | Not ported | Medium |
59+
| `test_finalizer` | Not ported | Medium |
60+
| `test_function` | Not ported | Medium |
61+
| `test_general` | Not ported | Hard |
62+
| `test_handle_scope` | Not ported | Easy |
63+
| `test_instance_data` | Not ported | Easy |
64+
| `test_new_target` | Not ported | Easy |
65+
| `test_number` | Not ported | Easy |
66+
| `test_object` | Not ported | Hard |
67+
| `test_promise` | Not ported | Easy |
68+
| `test_properties` | Not ported | Easy |
69+
| `test_reference` | Not ported | Medium |
70+
| `test_reference_double_free` | Not ported | Easy |
71+
| `test_sharedarraybuffer` | Not ported | Medium |
72+
| `test_string` | Not ported | Medium |
73+
| `test_symbol` | Not ported | Easy |
74+
| `test_typedarray` | Not ported | Medium |
7475

7576
## Runtime-specific (`node-api`)
7677

7778
Tests covering the runtime-specific part of Node-API, defined in `node_api.h`.
7879

79-
| Directory | Status | Difficulty |
80-
|---|---|---|
81-
| `1_hello_world` | Not ported | Easy |
82-
| `test_async` | Not ported | Hard |
83-
| `test_async_cleanup_hook` | Not ported | Hard |
84-
| `test_async_context` | Not ported | Hard |
85-
| `test_buffer` | Not ported | Medium |
86-
| `test_callback_scope` | Not ported | Hard |
87-
| `test_cleanup_hook` | Not ported | Medium |
88-
| `test_env_teardown_gc` | Not ported | Easy |
89-
| `test_exception` | Not ported | Easy |
90-
| `test_fatal` | Not ported | Hard |
91-
| `test_fatal_exception` | Not ported | Easy |
92-
| `test_general` | Not ported | Medium |
93-
| `test_init_order` | Not ported | Medium |
94-
| `test_instance_data` | Not ported | Hard |
95-
| `test_make_callback` | Not ported | Hard |
96-
| `test_make_callback_recurse` | Not ported | Hard |
97-
| `test_null_init` | Not ported | Medium |
98-
| `test_reference_by_node_api_version` | Not ported | Medium |
99-
| `test_sea_addon` | Not ported | Hard |
100-
| `test_threadsafe_function` | Not ported | Hard |
101-
| `test_threadsafe_function_shutdown` | Not ported | Hard |
102-
| `test_uv_loop` | Not ported | Hard |
103-
| `test_uv_threadpool_size` | Not ported | Hard |
104-
| `test_worker_buffer_callback` | Not ported | Hard |
105-
| `test_worker_terminate` | Not ported | Hard |
106-
| `test_worker_terminate_finalization` | Not ported | Hard |
80+
| Directory | Status | Difficulty |
81+
| ------------------------------------ | ---------- | ---------- |
82+
| `1_hello_world` | Not ported | Easy |
83+
| `test_async` | Not ported | Hard |
84+
| `test_async_cleanup_hook` | Not ported | Hard |
85+
| `test_async_context` | Not ported | Hard |
86+
| `test_buffer` | Not ported | Medium |
87+
| `test_callback_scope` | Not ported | Hard |
88+
| `test_cleanup_hook` | Not ported | Medium |
89+
| `test_env_teardown_gc` | Not ported | Easy |
90+
| `test_exception` | Not ported | Easy |
91+
| `test_fatal` | Not ported | Hard |
92+
| `test_fatal_exception` | Not ported | Easy |
93+
| `test_general` | Not ported | Medium |
94+
| `test_init_order` | Not ported | Medium |
95+
| `test_instance_data` | Not ported | Hard |
96+
| `test_make_callback` | Not ported | Hard |
97+
| `test_make_callback_recurse` | Not ported | Hard |
98+
| `test_null_init` | Not ported | Medium |
99+
| `test_reference_by_node_api_version` | Not ported | Medium |
100+
| `test_sea_addon` | Not ported | Hard |
101+
| `test_threadsafe_function` | Not ported | Hard |
102+
| `test_threadsafe_function_shutdown` | Not ported | Hard |
103+
| `test_uv_loop` | Not ported | Hard |
104+
| `test_uv_threadpool_size` | Not ported | Hard |
105+
| `test_worker_buffer_callback` | Not ported | Hard |
106+
| `test_worker_terminate` | Not ported | Hard |
107+
| `test_worker_terminate_finalization` | Not ported | Hard |
107108

108109
## Special Considerations
109110

@@ -144,6 +145,7 @@ The following tests call into libuv directly — `napi_get_uv_event_loop`, `uv_t
144145
- `test_uv_loop`, `test_uv_threadpool_size`
145146

146147
Porting options:
148+
147149
1. **Node-only scope** — mark these tests as Node.js-only and skip on other runtimes.
148150
2. **Harness abstraction** — introduce a minimal platform-agnostic threading/async API in the
149151
harness (e.g., `cts_thread_create`, `cts_async_schedule`) that implementors back with their

0 commit comments

Comments
 (0)