Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Before submitting a pull request, please read
https://github.com/nodejs/js-native-api-test/blob/main/CONTRIBUTING.md.
https://github.com/nodejs/node-api-cts/blob/main/CONTRIBUTING.md.

Developer's Certificate of Origin 1.1

Expand Down
18 changes: 18 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# **js-native-api-test** Contribution Philosophy
# **node-api-cts** Contribution Philosophy

The **node-addon-api** team which maintains **js-native-api-test**
The **node-addon-api** team which maintains **node-api-cts**
loves contributions. There are many ways in which you can
contribute:
- Source code fixes
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)
=====================

Copyright js-native-api-test and Node.js contributors
Copyright node-api-cts and Node.js contributors
-----------------------------------------------------

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# js-native-api-test
# Node-API Conformance Test Suite (`node-api-cts`)

Test suite for JavaScript Engine specific portion of Node-api.
A test suite for Node-API implementors across different JS engines and runtimes.
Written in ECMAScript & C/C++ with an implementor customizable harness.

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/js-native-api/*` testing the engine-specific part of Node-API defined in the [`js_native_api.h`](https://github.com/nodejs/node-api-headers/blob/main/include/js_native_api.h) header.
- `tests/node-api/*` testing the runtime-specific part of Node-API defined in the [`node_api.h`](https://github.com/nodejs/node-api-headers/blob/main/include/node_api.h) header.