Skip to content

fix: error out if node_modules doesn't contain correct @playwright/test version#1231

Merged
hwartig merged 1 commit intomainfrom
harry/red-167-browsers-launch-error-no-new-deps
Feb 20, 2026
Merged

fix: error out if node_modules doesn't contain correct @playwright/test version#1231
hwartig merged 1 commit intomainfrom
harry/red-167-browsers-launch-error-no-new-deps

Conversation

@hwartig
Copy link
Contributor

@hwartig hwartig commented Feb 20, 2026

The version of @playwright/test in node_modules might be out of sync with what is required in package.json/package-lock.json. In those rare cases the cli will report an incorrect playwright version to the API which will cause checks to fail as checks rely on the playwright version noted in lock files.

Affected Components

  • CLI

…st version

The version of @playwright/test in node_modules might be out of sync
with what is required in package.json/package-lock.json. In those rare
cases the cli will report an incorrect playwright version to the API
which will cause checks to fail as checks rely on the playwright version
noted in lock files.
@hwartig hwartig merged commit 139e04b into main Feb 20, 2026
4 checks passed
@hwartig hwartig deleted the harry/red-167-browsers-launch-error-no-new-deps branch February 20, 2026 13:39
const range =
packageJson.dependencies?.['@playwright/test']
?? packageJson.devDependencies?.['@playwright/test']
if (range && !semver.satisfies(version, range)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I already approved the PR and unfortunately you already merged, but I had a late suggestion. There is a possibility that the range is not valid. For example it could point to a local copy of the package or be something like "catalog:" w/ pnpm. For invalid ranges, satisfies() just returns false so they'll always hit this error. We should probably do this instead:

if (range) {
  const validRange = semver.validRange(range)
  if (validRange && !semver.satisfies(version, validRange)) {
    // throw
    // ...

Copy link
Contributor Author

@hwartig hwartig Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhrg right. good catch, I'll prep the PR

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.

2 participants