Skip to content

Comments

feat: add ability to get playwright version from lock file#1112

Merged
ferrandiaz merged 12 commits intomainfrom
ferran/sc-0/detect-pw-version
Jul 23, 2025
Merged

feat: add ability to get playwright version from lock file#1112
ferrandiaz merged 12 commits intomainfrom
ferran/sc-0/detect-pw-version

Conversation

@ferrandiaz
Copy link
Contributor

@ferrandiaz ferrandiaz commented Jul 16, 2025

Affected Components

  • CLI
  • Create CLI
  • Test
  • Docs
  • Examples
  • Other

Notes for the Reviewer

Add ability to parse lock files and get the playwright version from them so we can populate it as part of the playwright check
Filter out non playwright checks for pw-test command
Fix: Allow running pw-test on private locations

Copy link
Member

@sorccu sorccu left a comment

Choose a reason for hiding this comment

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

This seems overly complicated. Looking at https://github.com/microsoft/playwright/blob/a6cb0093567e3d539f93978362a8fa784c73f2fe/packages/playwright-test/package.json, @playwright/test exports its own package.json. Is the following not enough?

const { version } = require('@playwright/test/package.json')

Or am I misunderstanding what exactly you need from there?

@ferrandiaz
Copy link
Contributor Author

@sorccu We are trying to get it from the lock file, so the exact version the user is using.

@sorccu
Copy link
Member

sorccu commented Jul 16, 2025

Do you mean exact version (1.5.4) or exact version range (e.g. ^1.5)? Can you explain a little more? Just tell me exactly what you need and for what reason and I may be able to help. I would like to avoid this hackiness if there's any other alternative.

@ferrandiaz
Copy link
Contributor Author

@sorccu I mean exact version 1.5.4

@sorccu
Copy link
Member

sorccu commented Jul 16, 2025

That's exactly what you get with the snippet I posted. Though it has one caveat: it only works correctly as long as the CLI itself does not have @playwright/test as a dependency, but currently it does not.

Alternatively you could look up the closest node_modules folder and attempt to read node_modules/@playwright/test/package.json as a file, without require/import.

> (await import('@playwright/test/package.json', { with: { type: 'json' } })).default.version
'1.54.1'
> require('@playwright/test/package.json').version
'1.54.1'

@ferrandiaz ferrandiaz requested a review from sorccu July 17, 2025 09:14
@ferrandiaz ferrandiaz marked this pull request as ready for review July 17, 2025 13:04
@ferrandiaz ferrandiaz requested a review from sorccu July 22, 2025 14:23
@ferrandiaz ferrandiaz added the build Issue regarding building and packaging label Jul 23, 2025
@github-actions

This comment has been minimized.

@ferrandiaz ferrandiaz added build Issue regarding building and packaging and removed build Issue regarding building and packaging labels Jul 23, 2025
@github-actions
Copy link

🎉 Experimental release successfully published on npm

npm install checkly@0.0.0-pr.1112.5d2587e

@ferrandiaz ferrandiaz requested a review from umutuzgur July 23, 2025 08:35
Copy link
Member

@sorccu sorccu left a comment

Choose a reason for hiding this comment

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

I still think that require() or import() could have been used for this, but alright.

@ferrandiaz ferrandiaz merged commit 356eb73 into main Jul 23, 2025
3 checks passed
@ferrandiaz ferrandiaz deleted the ferran/sc-0/detect-pw-version branch July 23, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issue regarding building and packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants