File tree Expand file tree Collapse file tree 5 files changed +31
-0
lines changed
tests/js-native-api/test_string Expand file tree Collapse file tree 5 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ export default defineConfig([
1717 mustNotCall : "readonly" ,
1818 gcUntil : "readonly" ,
1919 experimentalFeatures : "readonly" ,
20+ napiVersion : "readonly" ,
21+ skipTest : "readonly" ,
2022 } ,
2123 } ,
2224 rules : {
Original file line number Diff line number Diff line change 1+ const napiVersion = Number ( process . versions . napi ) ;
2+
3+ const skipTest = ( ) => {
4+ process . exit ( 0 ) ;
5+ } ;
6+
7+ Object . assign ( globalThis , { napiVersion, skipTest } ) ;
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ const GC_MODULE_PATH = path.join(
3434 "node" ,
3535 "gc.js"
3636) ;
37+ const PROCESS_MODULE_PATH = path . join (
38+ ROOT_PATH ,
39+ "implementors" ,
40+ "node" ,
41+ "process.js"
42+ ) ;
3743const MUST_CALL_MODULE_PATH = path . join (
3844 ROOT_PATH ,
3945 "implementors" ,
@@ -79,6 +85,8 @@ export function runFileInSubprocess(
7985 "--import" ,
8086 "file://" + GC_MODULE_PATH ,
8187 "--import" ,
88+ "file://" + PROCESS_MODULE_PATH ,
89+ "--import" ,
8290 "file://" + MUST_CALL_MODULE_PATH ,
8391 filePath ,
8492 ] ,
Original file line number Diff line number Diff line change 11"use strict" ;
22
3+ // test_string addon requires Node-API version >= 10
4+ // (node_api_create_external_string_latin1/utf16).
5+ // Node-API 10 is supported in Node.js >= 22.14.0 and >= 23.6.0.
6+ if ( Number ( napiVersion ) < 10 ) {
7+ skipTest ( ) ;
8+ }
9+
310// Testing api calls for string
411const test_string = loadAddon ( "test_string" ) ;
512// The insufficient buffer test case allocates a buffer of size 4, including
Original file line number Diff line number Diff line change 11"use strict" ;
22
3+ // test_string addon requires Node-API version >= 10
4+ // (node_api_create_external_string_latin1/utf16).
5+ // Node-API 10 is supported in Node.js >= 22.14.0 and >= 23.6.0.
6+ if ( Number ( napiVersion ) < 10 ) {
7+ skipTest ( ) ;
8+ }
9+
310// Test passing NULL to object-related Node-APIs.
411const { testNull } = loadAddon ( "test_string" ) ;
512
You can’t perform that action at this time.
0 commit comments