File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 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 {
284284}
285285
286286func getNodeExecutable (driverDirectory string ) string {
287+ envPath := os .Getenv ("PLAYWRIGHT_NODEJS_PATH" )
288+ if envPath != "" {
289+ return envPath
290+ }
291+
287292 node := "node"
288293 if runtime .GOOS == "windows" {
289294 node = "node.exe"
Original file line number Diff line number Diff line change 99 "testing"
1010
1111 "github.com/mitchellh/go-ps"
12+ "github.com/stretchr/testify/assert"
1213 "github.com/stretchr/testify/require"
1314)
1415
@@ -88,6 +89,21 @@ func TestShouldNotHangWhenPlaywrightUnexpectedExit(t *testing.T) {
8889 require .Error (t , err )
8990}
9091
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+
91107// find and kill playwright process
92108func killPlaywrightProcess () error {
93109 all , err := ps .Processes ()
You can’t perform that action at this time.
0 commit comments