@@ -7,6 +7,7 @@ import { fileURLToPath } from 'url';
7
7
import { platform } from 'os' ;
8
8
import { spawnSync } from 'child_process' ;
9
9
import { WritableStream } from 'memory-streams' ;
10
+ import { nodePath } from '../src/lib/util.js' ;
10
11
11
12
const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
12
13
@@ -58,14 +59,14 @@ describe('Extension', () => {
58
59
delete env . SNOOPLOGG ;
59
60
const args = [
60
61
path . join ( __dirname , 'examples' , 'external-binary' , 'extbin.js' ) ,
61
- 'node' ,
62
+ nodePath ( ) ,
62
63
'-e' ,
63
64
'console.log(\'foo\');'
64
65
] ;
65
66
66
67
let s = '' , o = '' , e = '' ;
67
68
try {
68
- const { status, stdout, stderr } = spawnSync ( 'where' , [ 'node.exe' ] ) ;
69
+ const { status, stdout, stderr } = spawnSync ( 'where' , [ nodePath ( ) ] ) ;
69
70
s = status ; o = stdout ; e = stderr ;
70
71
} catch ( e ) {
71
72
console . log ( 'EROROROROROR!' , e ) ;
@@ -74,7 +75,7 @@ describe('Extension', () => {
74
75
console . log ( 'PLATFORM:' , platform ( ) ) ;
75
76
}
76
77
77
- const { status, stdout, stderr } = spawnSync ( 'node.exe' , args , {
78
+ const { status, stdout, stderr } = spawnSync ( nodePath ( ) , args , {
78
79
env,
79
80
shell : platform ( ) === 'win32'
80
81
} ) ;
@@ -90,7 +91,7 @@ describe('Extension', () => {
90
91
const env = { ...process . env } ;
91
92
delete env . SNOOPLOGG ;
92
93
93
- const { status, stdout, stderr } = spawnSync ( 'node' , [
94
+ const { status, stdout, stderr } = spawnSync ( nodePath ( ) , [
94
95
path . join ( __dirname , 'examples' , 'run-node' , 'run.js' ) , 'run' , 'console.log(\'It works\')'
95
96
] , {
96
97
env,
@@ -186,7 +187,7 @@ describe('Extension', () => {
186
187
const env = { ...process . env } ;
187
188
delete env . SNOOPLOGG ;
188
189
189
- const { status, stdout, stderr } = spawnSync ( 'node' , [
190
+ const { status, stdout, stderr } = spawnSync ( nodePath ( ) , [
190
191
path . join ( __dirname , 'examples' , 'external-js-file' , 'extjsfile.js' ) , 'simple' , 'foo' , 'bar'
191
192
] , {
192
193
env
@@ -202,7 +203,7 @@ describe('Extension', () => {
202
203
const env = { ...process . env } ;
203
204
delete env . SNOOPLOGG ;
204
205
205
- const { status, stdout, stderr } = spawnSync ( 'node' , [
206
+ const { status, stdout, stderr } = spawnSync ( nodePath ( ) , [
206
207
path . join ( __dirname , 'examples' , 'external-module' , 'extmod.js' ) , 'foo' , 'bar'
207
208
] , {
208
209
env
0 commit comments