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: 0 additions & 2 deletions implementors/node/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ globalThis.experimentalFeatures = {
postFinalizer: true,
};

globalThis.napiVersion = Number(process.versions.napi);

globalThis.skipTest = () => {
process.exit(0);
};
1 change: 1 addition & 0 deletions implementors/node/napi-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
globalThis.napiVersion = Number(process.versions.napi);
8 changes: 8 additions & 0 deletions implementors/node/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ const MUST_CALL_MODULE_PATH = path.join(
"node",
"must-call.js"
);
const NAPI_VERSION_MODULE_PATH = path.join(
ROOT_PATH,
"implementors",
"node",
"napi-version.js"
);

export function listDirectoryEntries(dir: string) {
const entries = fs.readdirSync(dir, { withFileTypes: true });
Expand Down Expand Up @@ -80,6 +86,8 @@ export function runFileInSubprocess(
"file://" + GC_MODULE_PATH,
"--import",
"file://" + MUST_CALL_MODULE_PATH,
"--import",
"file://" + NAPI_VERSION_MODULE_PATH,
filePath,
],
{ cwd }
Expand Down
6 changes: 6 additions & 0 deletions tests/harness/napi-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

// napiVersion is a positive integer
if (typeof napiVersion !== 'number' || napiVersion < 1 || !Number.isInteger(napiVersion)) {
throw new Error('Expected a global napiVersion that is a positive integer');
}
Loading