From da923711cf8bd66b859c27df0f312e4b56e42b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Sat, 29 Nov 2025 07:42:47 +0100 Subject: [PATCH 1/5] Update readme to reflect the current state of the project --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 73aef3f..22d100f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ -# js-native-api-test +# Node-API Conformance Test Suite (`node-api-cts`) -Test suite for JavaScript Engine specific portion of Node-api. +A pure ECMAScript test suite for Node-API implementors across different JS engines and runtimes. -This repository holds a copy of the js-native-api subset of the Node-api test suite so that -it can be used to validate native api implementations outside of Node.js. +> [!IMPORTANT] +> This repository is currently a work-in-progress and shouldn't yet be relied on by anyone. -Currently we are still working on the process to extract the test suite and publish it to this -repo on a regular basis. +## Overview + +The tests are divided into two buckets, based on the two header files declaring the Node-API functions: + +- `tests/engine/*` testing Node-API defined in the [`js_native_api.h`](https://github.com/nodejs/node-api-headers/blob/main/include/js_native_api.h) header (located in [`./test/js-native-api` of the Node.js codebase](https://github.com/nodejs/node/tree/main/test/js-native-api)). +- `tests/runtime/*` testing Node-API defined in the [`node_api.h`](https://github.com/nodejs/node-api-headers/blob/main/include/node_api.h) header (located in [`./test/node-api` of the Node.js codebase](https://github.com/nodejs/node/tree/main/test/node-api)). From 86729fa3c931e4d19be98ba93c85da4155e8f521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Sat, 29 Nov 2025 07:43:00 +0100 Subject: [PATCH 2/5] Add instructions for copilot to pick up --- .github/copilot-instructions.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..e9388be --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,18 @@ +# Copilot Instructions for node-api-cts + +## Project Overview + +Node-API Conformance Test Suite: A pure ECMAScript test suite for Node-API implementors across different JS engines and runtimes (Node.js, Deno, Bun, React Native, WebAssembly, etc.). + +## General Principles +- **Keep it minimal**: Avoid unnecessary dependencies, configuration, or complexity +- **Pure ECMAScript tests**: To lower the barrier for implementors to run the tests, all tests are written as single files of pure ECMAScript, with no import / export statements and no use of Node.js runtime APIs outside of the language standard (such as `process`, `require`, `node:*` modules). +- **TypeScript tooling**: The tooling around the tests are written in TypeScript and expects to be ran in a Node.js compatible runtime with type-stripping enabled. +- **Implementor Flexibility**: Native code building and loading is delegated to implementors, with the test-suite providing defaults that work for Node.js. +- **Extra convenience**: Extra (generated) code is provided to make it easier for implementors to load and run tests, such as extra package exports exposing test functions that implementors can integrate with their preferred test frameworks. +- **Process Isolation**: The built-in runner for Node.js, run each test in isolation to prevent crashes from aborting entire test suite. + +## Development Focus +- Port existing tests from `nodejs/node/test/js-native-api` into `tests/engine/` and `nodejs/node/test/node-api` into `tests/runtime/`, removing dependencies on Node.js runtime APIs while preserving test coverage +- Structure tests for easy integration by external implementors +- Consider following patterns from [web-platform-tests](https://web-platform-tests.org/) and [WebGPU CTS](https://github.com/gpuweb/cts) projects where applicable. From 0b20fc173095def9d716b420c89ff999bd454317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Sat, 29 Nov 2025 07:44:28 +0100 Subject: [PATCH 3/5] Replace mentions of "js-native-api-test" for "node-api-cts" --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- CONTRIBUTING.md | 4 ++-- LICENSE.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index aed745f..f890ba1 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@