Skip to content

feat: allow PLAYWRIGHT_CLI_PATH to point directly at cli.js#618

Merged
mxschmitt merged 1 commit into
mainfrom
feat/allow-cli-path-env
Jun 26, 2026
Merged

feat: allow PLAYWRIGHT_CLI_PATH to point directly at cli.js#618
mxschmitt merged 1 commit into
mainfrom
feat/allow-cli-path-env

Conversation

@mxschmitt

Copy link
Copy Markdown
Owner

Problem

Closes #575.

On NixOS, the official playwright-driver package keeps cli.js at the package root, whereas playwright-go's getDriverCliJs hardcodes <DriverDirectory>/package/cli.js. As a result, even when users point PLAYWRIGHT_DRIVER_PATH at the Nix store path, resolution fails — forcing symlink workarounds in their flakes (see the issue thread).

Fix

Add a PLAYWRIGHT_CLI_PATH env var that points directly at cli.js, bypassing the assumed package/ layout. This deliberately mirrors the existing PLAYWRIGHT_NODEJS_PATH escape hatch (which already lets users point directly at the Node.js binary), so both halves of the driver are now symmetric.

With this, the reporter's flake reduces to:

export PLAYWRIGHT_CLI_PATH="${pkgs.playwright-driver}/cli.js"
export PLAYWRIGHT_NODEJS_PATH="${pkgs.nodejs}/bin/node"

Changes

  • getDriverCliJs honors PLAYWRIGHT_CLI_PATH before falling back to the default layout.
  • Documented the new var in the RunOptions.DriverDirectory doc comment.
  • Added TestGetDriverCliJs, mirroring TestGetNodeExecutable.

go build ./... and the targeted tests pass.

The official NixOS playwright-driver package keeps cli.js at the package
root rather than under package/, so getDriverCliJs could not resolve it
even with PLAYWRIGHT_DRIVER_PATH set. Add a PLAYWRIGHT_CLI_PATH env var
that points directly at cli.js, bypassing the assumed layout. This
mirrors the existing PLAYWRIGHT_NODEJS_PATH escape hatch for the Node.js
binary.

Closes #575
@mxschmitt mxschmitt merged commit 7e12526 into main Jun 26, 2026
19 of 21 checks passed
@mxschmitt mxschmitt deleted the feat/allow-cli-path-env branch June 26, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Allow us to set the full path to cli js (driver)

1 participant