diff --git a/implementors/node/globals.js b/implementors/node/globals.js new file mode 100644 index 0000000..e460683 --- /dev/null +++ b/implementors/node/globals.js @@ -0,0 +1,5 @@ +import "./features.js"; +import "./assert.js"; +import "./load-addon.js"; +import "./gc.js"; +import "./must-call.js"; diff --git a/implementors/node/tests.ts b/implementors/node/tests.ts index d4f8b2c..39350de 100644 --- a/implementors/node/tests.ts +++ b/implementors/node/tests.ts @@ -5,40 +5,16 @@ import path from "node:path"; assert( typeof import.meta.dirname === "string", - "Expecting a recent Node.js runtime API version" + "Expecting a recent Node.js runtime API version", ); const ROOT_PATH = path.resolve(import.meta.dirname, "..", ".."); const TESTS_ROOT_PATH = path.join(ROOT_PATH, "tests"); -const FEATURES_MODULE_PATH = path.join( +const GLOBALS_MODULE_PATH = path.join( ROOT_PATH, "implementors", "node", - "features.js" -); -const ASSERT_MODULE_PATH = path.join( - ROOT_PATH, - "implementors", - "node", - "assert.js" -); -const LOAD_ADDON_MODULE_PATH = path.join( - ROOT_PATH, - "implementors", - "node", - "load-addon.js" -); -const GC_MODULE_PATH = path.join( - ROOT_PATH, - "implementors", - "node", - "gc.js" -); -const MUST_CALL_MODULE_PATH = path.join( - ROOT_PATH, - "implementors", - "node", - "must-call.js" + "globals.js", ); export function listDirectoryEntries(dir: string) { @@ -62,7 +38,7 @@ export function listDirectoryEntries(dir: string) { export function runFileInSubprocess( cwd: string, - filePath: string + filePath: string, ): Promise { return new Promise((resolve, reject) => { const child = spawn( @@ -71,18 +47,10 @@ export function runFileInSubprocess( // Using file scheme prefix when to enable imports on Windows "--expose-gc", "--import", - "file://" + FEATURES_MODULE_PATH, - "--import", - "file://" + ASSERT_MODULE_PATH, - "--import", - "file://" + LOAD_ADDON_MODULE_PATH, - "--import", - "file://" + GC_MODULE_PATH, - "--import", - "file://" + MUST_CALL_MODULE_PATH, + "file://" + GLOBALS_MODULE_PATH, filePath, ], - { cwd } + { cwd }, ); let stderrOutput = ""; @@ -111,9 +79,9 @@ export function runFileInSubprocess( new Error( `Test file ${path.relative( TESTS_ROOT_PATH, - filePath - )} failed (${reason})${stderrSuffix}` - ) + filePath, + )} failed (${reason})${stderrSuffix}`, + ), ); }); });