Skip to content

Commit

Permalink
feat: add PLAYWRIGHT_DRIVER_PATH env to specify the driver directory
Browse files Browse the repository at this point in the history
  • Loading branch information
canstand authored Sep 13, 2024
1 parent 6717168 commit 614b948
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type PlaywrightDriver struct {

func NewDriver(options *RunOptions) (*PlaywrightDriver, error) {
baseDriverDirectory := options.DriverDirectory
if baseDriverDirectory == "" {
baseDriverDirectory := os.Getenv("PLAYWRIGHT_DRIVER_PATH")

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / test-examples

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / verify

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / chromium on ubuntu-latest, go stable

declared and not used: baseDriverDirectory

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / Lint

baseDriverDirectory declared and not used) (typecheck)

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / Lint

baseDriverDirectory declared and not used (typecheck)

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / Lint

baseDriverDirectory declared and not used) (typecheck)

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / chromium on ubuntu-latest, go oldstable

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / firefox on ubuntu-latest, go stable

declared and not used: baseDriverDirectory

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / firefox on ubuntu-latest, go oldstable

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / webkit on ubuntu-latest, go stable

declared and not used: baseDriverDirectory

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / webkit on ubuntu-latest, go oldstable

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / chromium on windows-latest, go stable

declared and not used: baseDriverDirectory

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / chromium on windows-latest, go oldstable

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / firefox on windows-latest, go stable

declared and not used: baseDriverDirectory

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / firefox on windows-latest, go oldstable

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / webkit on windows-latest, go stable

declared and not used: baseDriverDirectory

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / webkit on windows-latest, go oldstable

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / chromium on macos-13, go stable

declared and not used: baseDriverDirectory

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / chromium on macos-13, go oldstable

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / firefox on macos-13, go stable

declared and not used: baseDriverDirectory

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / firefox on macos-13, go oldstable

baseDriverDirectory declared and not used

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / webkit on macos-13, go stable

declared and not used: baseDriverDirectory

Check failure on line 41 in run.go

View workflow job for this annotation

GitHub Actions / webkit on macos-13, go oldstable

baseDriverDirectory declared and not used
}
if baseDriverDirectory == "" {
var err error
baseDriverDirectory, err = getDefaultCacheDirectory()
Expand All @@ -52,10 +55,6 @@ func NewDriver(options *RunOptions) (*PlaywrightDriver, error) {
}

func getDefaultCacheDirectory() (string, error) {
if cachePath := os.Getenv("PLAYWRIGHT_BROWSERS_PATH"); cachePath != "" {
return cachePath, nil
}

userHomeDir, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("could not get user home directory: %w", err)
Expand Down

0 comments on commit 614b948

Please sign in to comment.