Skip to content

Commit 32311d1

Browse files
kraenhansenclaudelegendecas
authored
chore: extract skipTest into its own harness module (#56)
Move skipTest from features.js into a dedicated skip-test.js file, matching the pattern of other harness utilities (assert, must-call, gc). Add a harness test to verify the global exists. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Chengzhong Wu <cwu631@bloomberg.net>
1 parent e5ddc4a commit 32311d1

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

implementors/node/features.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ globalThis.experimentalFeatures = {
77
setPrototype: true,
88
postFinalizer: true,
99
};
10-
11-
globalThis.skipTest = () => {
12-
process.exit(0);
13-
};

implementors/node/skip-test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
globalThis.skipTest = () => {
2+
process.exit(0);
3+
};

implementors/node/tests.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ const MUST_CALL_MODULE_PATH = path.join(
4040
"node",
4141
"must-call.js"
4242
);
43+
const SKIP_TEST_MODULE_PATH = path.join(
44+
ROOT_PATH,
45+
"implementors",
46+
"node",
47+
"skip-test.js"
48+
);
4349
const NAPI_VERSION_MODULE_PATH = path.join(
4450
ROOT_PATH,
4551
"implementors",
@@ -87,6 +93,8 @@ export function runFileInSubprocess(
8793
"--import",
8894
"file://" + MUST_CALL_MODULE_PATH,
8995
"--import",
96+
"file://" + SKIP_TEST_MODULE_PATH,
97+
"--import",
9098
"file://" + NAPI_VERSION_MODULE_PATH,
9199
filePath,
92100
],

tests/harness/skip-test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
// skipTest is a function
4+
if (typeof skipTest !== 'function') {
5+
throw new Error('Expected a global skipTest function');
6+
}

0 commit comments

Comments
 (0)