percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
67 stars 40 forks source link

Percy does not work with Yarn PnP #1612

Open wojtekmaj opened 4 weeks ago

wojtekmaj commented 4 weeks ago

The problem

[percy] Error: @percy/cli-exec tried to access @percy/client, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: @percy/client (via "@percy/client/utils")
Required by: @percy/cli-exec@npm:1.28.7 (via /Users/wmaj/.yarn/berry/cache/@percy-cli-exec-npm-1.28.7-55645a8ef5-10c0.zip/node_modules/@percy/cli-exec/dist/exec.js)

…followed by a couple more similar errors.

Environment

Details

The error described above appears when percy exec command is attempted from Yarn Plug'n'Play, which is treating wrong/missing dependencies more strictly than other package managers. While this error appears on Yarn only, it signifies a deeper issue that other users of other package managers might encounter.

Adding the following to yarnrc.yml:

packageExtensions:
  '@percy/cli-exec@*':
    dependencies:
      '@percy/client': '*'
  '@percy/playwright@*':
    dependencies:
      '@percy/sdk-utils': '*'
    peerDependencies:
      playwright: '*'

fixes the issue, but it shouldn't be necessary.

prklm10 commented 3 weeks ago

Hi @wojtekmaj thanks for raising this, we will take this as a feature request and get back to you. There is no ETA for this as of now.