Skip to content

Support execution at the root of a PNPM monorepo #27203

@TeChn4K

Description

@TeChn4K

When executing pnpm dlx create-playwright --ct at the root of a PNPM monorepo, create-playwright throw an error because -w arg is not given.

pnpm dlx create-playwright --ct

.../share/pnpm/store/v3/tmp/dlx-21547    |   +1 +
.../share/pnpm/store/v3/tmp/dlx-21547    | Progress: resolved 1, reused 1, downloaded 0, added 1, done

Getting started with writing end-to-end tests with Playwright:
Initializing project in '.'
✔ Which framework do you use? (experimental) · react
✔ Install Playwright browsers (can be done manually via 'pnpm exec playwright install')? (Y/n) · true
✔ Install Playwright operating system dependencies (requires sudo / root - can be done manually via 'sudo pnpm exec playwright install-deps')? (y/N) · true

Installing Playwright Component Testing (pnpm add --save-dev @playwright/experimental-ct-react)…

ERR_PNPM_ADDING_TO_ROOT  Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.
Error: Command failed: pnpm add --save-dev @playwright/experimental-ct-react
    at checkExecSyncError (node:child_process:861:11)
    at execSync (node:child_process:932:15)
    at executeCommands (/home/myuser/.local/share/pnpm/store/v3/tmp/dlx-21547/node_modules/.pnpm/create-playwright@1.17.126/node_modules/create-playwright/lib/index.js:4519:39)
    at Generator.run (/home/myuser/.local/share/pnpm/store/v3/tmp/dlx-21547/node_modules/.pnpm/create-playwright@1.17.126/node_modules/create-playwright/lib/index.js:4670:5)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /home/myuser/.local/share/pnpm/store/v3/tmp/dlx-21547/node_modules/.pnpm/create-playwright@1.17.126/node_modules/create-playwright/lib/index.js:4938:3 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 21571,
  stdout: null,
  stderr: null
}
 ERROR  Command failed with exit code 1: create-playwright --ct

pnpm: Command failed with exit code 1: create-playwright --ct
    at makeError (/usr/lib/node_modules/pnpm/dist/pnpm.cjs:23113:17)
    at handlePromise (/usr/lib/node_modules/pnpm/dist/pnpm.cjs:23684:33)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.handler [as dlx] (/usr/lib/node_modules/pnpm/dist/pnpm.cjs:209846:7)
    at async /usr/lib/node_modules/pnpm/dist/pnpm.cjs:217519:21
    at async main (/usr/lib/node_modules/pnpm/dist/pnpm.cjs:217488:34)
    at async runPnpm (/usr/lib/node_modules/pnpm/dist/pnpm.cjs:217718:5)
    at async /usr/lib/node_modules/pnpm/dist/pnpm.cjs:217710:7

I had to manually add -w in the source code of create-playwright

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions