File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -284,6 +284,11 @@ func transformRunOptions(options []*RunOptions) *RunOptions {
284
284
}
285
285
286
286
func getNodeExecutable (driverDirectory string ) string {
287
+ envPath := os .Getenv ("PLAYWRIGHT_NODEJS_PATH" )
288
+ if envPath != "" {
289
+ return envPath
290
+ }
291
+
287
292
node := "node"
288
293
if runtime .GOOS == "windows" {
289
294
node = "node.exe"
Original file line number Diff line number Diff line change 9
9
"testing"
10
10
11
11
"github.com/mitchellh/go-ps"
12
+ "github.com/stretchr/testify/assert"
12
13
"github.com/stretchr/testify/require"
13
14
)
14
15
@@ -88,6 +89,21 @@ func TestShouldNotHangWhenPlaywrightUnexpectedExit(t *testing.T) {
88
89
require .Error (t , err )
89
90
}
90
91
92
+ func TestGetNodeExecutable (t * testing.T ) {
93
+ // When PLAYWRIGHT_NODEJS_PATH is set, use that path.
94
+ err := os .Setenv ("PLAYWRIGHT_NODEJS_PATH" , "envDir/node.exe" )
95
+ require .NoError (t , err )
96
+
97
+ executable := getNodeExecutable ("testDirectory" )
98
+ assert .Equal (t , "envDir/node.exe" , executable )
99
+
100
+ err = os .Unsetenv ("PLAYWRIGHT_NODEJS_PATH" )
101
+ require .NoError (t , err )
102
+
103
+ executable = getNodeExecutable ("testDirectory" )
104
+ assert .Contains (t , executable , "testDirectory" )
105
+ }
106
+
91
107
// find and kill playwright process
92
108
func killPlaywrightProcess () error {
93
109
all , err := ps .Processes ()
You can’t perform that action at this time.
0 commit comments