| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 441645c commit 9aa4c88
38 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,7 @@ Node-API Conformance Test Suite: A pure ECMAScript test suite for Node-API imple | |||
| 6 | 6 | ||
| 7 | 7 | ## General Principles | |
| 8 | 8 | - **Keep it minimal**: Avoid unnecessary dependencies, configuration, or complexity | |
| 9 | - - **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). | ||
| 9 | + - **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). Test files are evaluated as ES modules, which are always in strict mode, so drop the `'use strict'` directive when porting a file that carries one. | ||
| 10 | 10 | - **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. Never rely on `ts-node`, `node --loader ts-node/esm`, or `--experimental-strip-types`; use only stable, built-in Node.js capabilities. | |
| 11 | 11 | - **Implementor Flexibility**: Native code building and loading is delegated to implementors, with the test-suite providing defaults that work for Node.js. | |
| 12 | 12 | - **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. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | - | ||
| 3 | 1 | assert.ok( | |
| 4 | 2 | typeof experimentalFeatures === 'object' && experimentalFeatures !== null, | |
| 5 | 3 | 'Expected a global experimentalFeatures object', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | - | ||
| 3 | 1 | if (typeof loadAddon !== 'function') { | |
| 4 | 2 | throw new Error('Expected a global loadAddon function'); | |
| 5 | 3 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | - | ||
| 3 | 1 | // napiVersion is a positive integer | |
| 4 | 2 | if (typeof napiVersion !== 'number' || napiVersion < 1 || !Number.isInteger(napiVersion)) { | |
| 5 | 3 | throw new Error('Expected a global napiVersion that is a positive integer'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | - | ||
| 3 | 1 | // skipTest is a function | |
| 4 | 2 | if (typeof skipTest !== 'function') { | |
| 5 | 3 | throw new Error('Expected a global skipTest function'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | 1 | const addon = loadAddon('3_callbacks'); | |
| 3 | 2 | ||
| 4 | 3 | addon.RunCallback(mustCall((msg) => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | 1 | const addon = loadAddon('4_object_factory'); | |
| 3 | 2 | ||
| 4 | 3 | const obj1 = addon('hello'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | 1 | const addon = loadAddon('5_function_factory'); | |
| 3 | 2 | ||
| 4 | 3 | const fn = addon(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | 1 | const test = loadAddon('7_factory_wrap'); | |
| 3 | 2 | ||
| 4 | 3 | assert.strictEqual(test.finalizeCount, 0); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - 'use strict'; | ||
| 2 | 1 | const addon = loadAddon('8_passing_wrapped'); | |
| 3 | 2 | ||
| 4 | 3 | let obj1 = addon.createObject(10); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments