@@ -38,35 +38,35 @@ const args = parseArgs({
3838
3939const harnesses = {
4040 node : async ( { preludeScript } ) => {
41- let options = await nodePlatform . defaultNodeSetup ( {
42- args : testFrameworkArgs ,
43- onExit : ( code ) => {
44- if ( code !== 0 ) { return }
45- // Extract the coverage file from the wasm module
46- const filePath = "default.profraw"
47- const destinationPath = args . values [ "coverage-file" ] ?? filePath
48- const profraw = options . wasi . extractFile ?. ( filePath )
49- if ( profraw ) {
50- console . log ( `Saved ${ filePath } to ${ destinationPath } ` ) ;
51- writeFileSync ( destinationPath , profraw ) ;
41+ try {
42+ let options = await nodePlatform . defaultNodeSetup ( {
43+ args : testFrameworkArgs ,
44+ onExit : ( code ) => {
45+ if ( code !== 0 ) { return }
46+ // Extract the coverage file from the wasm module
47+ const filePath = "default.profraw"
48+ const destinationPath = args . values [ "coverage-file" ] ?? filePath
49+ const profraw = options . wasi . extractFile ?. ( filePath )
50+ if ( profraw ) {
51+ console . log ( `Saved ${ filePath } to ${ destinationPath } ` ) ;
52+ writeFileSync ( destinationPath , profraw ) ;
53+ }
54+ } ,
55+ /* #if USE_SHARED_MEMORY */
56+ spawnWorker : nodePlatform . createDefaultWorkerFactory ( preludeScript )
57+ /* #endif */
58+ } )
59+ if ( preludeScript ) {
60+ const prelude = await import ( preludeScript )
61+ if ( prelude . setupOptions ) {
62+ options = prelude . setupOptions ( options , { isMainThread : true } )
5263 }
53- } ,
54- /* #if USE_SHARED_MEMORY */
55- spawnWorker : nodePlatform . createDefaultWorkerFactory ( preludeScript )
56- /* #endif */
57- } )
58- if ( preludeScript ) {
59- const prelude = await import ( preludeScript )
60- if ( prelude . setupOptions ) {
61- options = prelude . setupOptions ( options , { isMainThread : true } )
6264 }
63- }
64- try {
6565 await instantiate ( options )
6666 } catch ( e ) {
6767 if ( e instanceof WebAssembly . CompileError ) {
6868 // Check Node.js major version
69- const nodeVersion = process . version . split ( "." ) [ 0 ]
69+ const nodeVersion = process . versions . node . split ( "." ) [ 0 ]
7070 const minNodeVersion = 20
7171 if ( nodeVersion < minNodeVersion ) {
7272 console . error ( `Hint: Node.js version ${ nodeVersion } is not supported, please use version ${ minNodeVersion } or later.` )
0 commit comments