Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The merge-reports command does not work. #26541

Closed
1 task done
radekmie opened this issue Aug 18, 2023 · 4 comments · Fixed by #26542
Closed
1 task done

[BUG] The merge-reports command does not work. #26541

radekmie opened this issue Aug 18, 2023 · 4 comments · Fixed by #26542
Assignees
Labels

Comments

@radekmie
Copy link

System info

  • Playwright Version: v1.37.0 and v1.37.1
  • Operating System: macOS 13.4.1 and macOS 13.5
  • Browser: N/A
  • Other info: Node.js 16.15.0 and Node.js v18.15.0

Source code

  • I provided exact source code that allows reproducing the issue locally.

Config file

N/A

Test file (self-contained)

N/A

Steps

  1. Run the new merge-reports command.
    npx [email protected] merge-reports

Expected

The command should be there and work as documented.

Actual

The command is not detected and an error is thrown:

error: unknown command 'merge-reports'
@mxschmitt
Copy link
Member

You need to install your dependencies (including @playwright/test) before running the npx playwright merge-reports command. This usually means: npm ci.

I created #26542 which will give us a better error message compare to unknown command.

@radekmie
Copy link
Author

Yeah, that solved it, but only with npm - it still doesn't work with pnpm. See these two traces:

npm
λ ~/ mkdir playwright-command-issue-npm
λ ~/ cd playwright-command-issue-npm 
λ ~/playwright-command-issue-npm/ npm init -y
Wrote to /Users/radekmie/playwright-command-issue-npm/package.json:

{
  "name": "playwright-command-issue-npm",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Radosław Miernik <REDACTED>",
  "license": "ISC"
}


λ ~/playwright-command-issue-npm/ npm i playwright

added 2 packages in 373ms
λ ~/playwright-command-issue-npm/ npx playwright merge-reports
error: unknown command 'merge-reports'
λ ~/playwright-command-issue-npm/ npm i @playwright/test      

added 3 packages in 337ms
λ ~/playwright-command-issue-npm/ npx playwright merge-reports
Error: No report files found in /Users/radekmie/playwright-command-issue-npm
    at createMergedReport (/Users/radekmie/playwright-command-issue-npm/node_modules/@playwright/test/lib/reporters/merge.js:44:38)
    at mergeReports (/Users/radekmie/playwright-command-issue-npm/node_modules/@playwright/test/lib/cli.js:178:3)
    at i.<anonymous> (/Users/radekmie/playwright-command-issue-npm/node_modules/@playwright/test/lib/cli.js:93:7)
λ ~/playwright-command-issue-npm/ 
pnpm
λ ~/ mkdir playwright-command-issue-pnpm
λ ~/ cd playwright-command-issue-pnpm 
λ ~/playwright-command-issue-pnpm/ npm init -y
Wrote to /Users/radekmie/playwright-command-issue-pnpm/package.json:

{
  "name": "playwright-command-issue-pnpm",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Radosław Miernik <REDACTED>",
  "license": "ISC"
}


λ ~/playwright-command-issue-pnpm/ npm i -g pnpm

added 1 package in 456ms

1 package is looking for funding
  run `npm fund` for details
λ ~/playwright-command-issue-pnpm/ pnpm i playwright
zsh: correct 'pnpm' to 'npm' [nyae]? n
Packages: +2
++
Packages are copied from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/radekmie/Library/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 2, reused 0, downloaded 2, added 2, done
node_modules/.pnpm/[email protected]/node_modules/playwright: Running install scnode_modules/.pnpm/[email protected]/node_modules/playwright: Running install script, done in 111ms

dependencies:
+ playwright 1.37.1

Done in 1s
λ ~/playwright-command-issue-pnpm/ pnpm exec playwright merge-reports
error: unknown command 'merge-reports'
λ ~/playwright-command-issue-pnpm/ pnpm i @playwright/test           
Packages: +3
+++
Progress: resolved 5, reused 2, downloaded 3, added 3, done

dependencies:
+ @playwright/test 1.37.1

Done in 687ms
λ ~/playwright-command-issue-pnpm/ pnpm exec playwright merge-reports
error: unknown command 'merge-reports'
λ ~/playwright-command-issue-pnpm/ 

I know it's a bare report, but I've tried updating Playwright to 1.37.0 (and 1.37.1), and while it works (pnpm exec playwright --version states the correct version and running the tests just works), the merge-reports command is still not there.

Should I report a separate issue then?

@mxschmitt
Copy link
Member

You don't need to install playwright. Install only @playwright/test which provides the playwright command and then it should work.

@radekmie
Copy link
Author

It helped, thanks! But it’s weird that it breaks with playwright installed (I know it’s due to them using the same name, but still - counter intuitive).

Germandrummer92 pushed a commit to OctoMind-dev/playwright that referenced this issue Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants