Skip to content

Commit

Permalink
deploy: 3158371
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Jun 17, 2024
1 parent 55874aa commit ced45c8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
8 changes: 4 additions & 4 deletions assets/css/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ func transformRunOptions(options []*RunOptions) *RunOptions {
}

func getNodeExecutable(driverDirectory string) string {
envPath := os.Getenv("PLAYWRIGHT_NODEJS_PATH")
if envPath != "" {
return envPath
}

node := "node"
if runtime.GOOS == "windows" {
node = "node.exe"
Expand Down
16 changes: 16 additions & 0 deletions run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"testing"

"github.com/mitchellh/go-ps"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -88,6 +89,21 @@ func TestShouldNotHangWhenPlaywrightUnexpectedExit(t *testing.T) {
require.Error(t, err)
}

func TestGetNodeExecutable(t *testing.T) {
// When PLAYWRIGHT_NODEJS_PATH is set, use that path.
err := os.Setenv("PLAYWRIGHT_NODEJS_PATH", "envDir/node.exe")
require.NoError(t, err)

executable := getNodeExecutable("testDirectory")
assert.Equal(t, "envDir/node.exe", executable)

err = os.Unsetenv("PLAYWRIGHT_NODEJS_PATH")
require.NoError(t, err)

executable = getNodeExecutable("testDirectory")
assert.Contains(t, executable, "testDirectory")
}

// find and kill playwright process
func killPlaywrightProcess() error {
all, err := ps.Processes()
Expand Down

0 comments on commit ced45c8

Please sign in to comment.