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] Install instructions fail when using bun (create script uses npm instead of bun) #29301

Closed
jsonMartin opened this issue Feb 1, 2024 · 2 comments

Comments

@jsonMartin
Copy link

I'm trying to set up Playwright in my NextJS 14 project (which is built using a bun monorepo).

Unfortunately, the initial install step is failing when using bun because the install script tries to use npm package manager instead of bun. This is completely failing in a monorepo setup, because npm can't handle it. But even if the install step initially did work installiing via npm, then I'm assuming it still wouldn't correctly work with bun's lockfile as it's using a different package manager.

System info

  • Playwright Version: [v1.41.2]
  • Operating System: MacOS
  • Browser: N/A
  • Other info: N/A

Source code

bun create playwright

Getting started with writing end-to-end tests with Playwright:
Initializing project in '.'
✔ Where to put your end-to-end tests? · tests
✔ Add a GitHub Actions workflow? (y/N) · false
✔ Install Playwright browsers (can be done manually via 'npx playwright install')? (Y/n) · true
Installing Playwright Test (npm install --save-dev @playwright/test)…
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:../../packages/backend-api

Steps
bun create playwright

Expected
Install script works and uses bun instead of npm

Actual
Install Script fails because it's using the wrong package manager

@pavelfeldman
Copy link
Member

Bun is not supported by Playwright.

@jsonMartin
Copy link
Author

jsonMartin commented Feb 1, 2024

Hey @pavelfeldman , from what I see it appears that the blocking issues preventing bun from working were closed as resolved 2 weeks ago: oven-sh/bun#4751

After a little more tinkering I was able to get this working with bun successfully. The hard part was just getting it installed properly: yarn create also failed for me (because it didn't like the bun monorepo), but pnpm create worked to create the Playwright install files (I just discarded the lockfile afterwards).

Calling via the bun cli, the sample tests work just fine for me:

$ bunx playwright test

Running 6 tests using 6 workers
  6 passed (4.0s)

To open last HTML report run:

  npx playwright show-report

[edit]: I tested bunx playwright test and bunx playwright show-report and both work successfully. It does not work when I use npx playwright test and npx playwright show-report (likely due to monorepo), so bun's runtime appears to be working successfully.

Would you reconsider marking this as complete (or create a new issue) until there is a better solution? Even if bun has no plans to be officially supported, at least putting some documentation on the website would be helpful 🙏🏼

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

No branches or pull requests

2 participants