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

fix(testing): install devkit when init playwright #19406

Merged

Conversation

barbados-clemens
Copy link
Contributor

@barbados-clemens barbados-clemens commented Oct 2, 2023

Current Behavior

playwright generated config uses @nx/devkit which is not installed via playwright plugin
This usually works bc devkit is installed, but when using nx global install with pnpm
playwright an error is through saying it cannot find devkit

❯ nx e2e demo-e2e --skip-nx-cache

> nx run demo-e2e:e2e

 >  NX   Ensuring Playwright is installed.
   use --skipInstall to skip installation.
Error: Cannot find module '@nx/devkit'
Require stack:
- /Users/caleb/Work/sandbox/playwright-devkit/apps/demo-e2e/playwright.config.ts
- /Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/transform/transform.js
- /Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/common/config.js
- /Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/reporters/json.js
- /Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/reporters/raw.js
- /Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/reporters/html.js
- /Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/runner/reporters.js
- /Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/runner/runner.js
- /Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/cli.js
- /Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Function.resolveFilename (/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/transform/transform.js:191:36)
    at Function.Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/caleb/Work/sandbox/playwright-devkit/apps/demo-e2e/playwright.config.ts:4:1)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module.f._compile (/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/utilsBundleImpl.js:16:994)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Object.i.<computed>.ut._extensions.<computed> (/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/utilsBundleImpl.js:16:1010)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Function.Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at requireOrImport (/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/transform/transform.js:172:20)
    at requireOrImportDefaultObject (/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/common/configLoader.js:83:53)
    at ConfigLoader.loadConfigFile (/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/common/configLoader.js:56:26)
    at runTests (/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/cli.js:120:55)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at qr.<anonymous> (/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/cli.js:40:7) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/caleb/Work/sandbox/playwright-devkit/apps/demo-e2e/playwright.config.ts',
    '/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/transform/transform.js',
    '/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/common/config.js',
    '/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/reporters/json.js',
    '/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/reporters/raw.js',
    '/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/reporters/html.js',
    '/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/runner/reporters.js',
    '/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/runner/runner.js',
    '/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/lib/cli.js',
    '/Users/caleb/Work/sandbox/playwright-devkit/node_modules/.pnpm/@playwright+test@1.36.0/node_modules/@playwright/test/cli.js'
  ]
}

 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Ran target e2e for project demo-e2e (999ms)

    ✖    1/1 failed
    ✔    0/1 succeeded [0 read from cache]

Expected Behavior

playwright runs from both local and global installs

Related Issue(s)

Fixes #

@vercel
Copy link

vercel bot commented Oct 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Oct 3, 2023 6:15pm

@barbados-clemens barbados-clemens self-assigned this Oct 2, 2023
@barbados-clemens barbados-clemens added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Oct 2, 2023
@barbados-clemens barbados-clemens marked this pull request as ready for review October 2, 2023 14:22
@barbados-clemens barbados-clemens requested a review from a team as a code owner October 2, 2023 14:22
@AgentEnder AgentEnder enabled auto-merge (squash) October 2, 2023 14:26
playwright generated config uses `@nx/devkit` which is not installed via playwright plugin
This usually works bc devkit is installed, but when using nx global install with
playwright an error is through saying it cannot find devkit
@barbados-clemens barbados-clemens force-pushed the fix/install-devkit-with-playwright branch from 16f4f1a to 985a7af Compare October 3, 2023 18:14
@AgentEnder AgentEnder merged commit a1a69a1 into nrwl:master Oct 3, 2023
6 checks passed
@barbados-clemens barbados-clemens deleted the fix/install-devkit-with-playwright branch October 3, 2023 19:13
FrozenPandaz pushed a commit that referenced this pull request Oct 4, 2023
@github-actions
Copy link

github-actions bot commented Oct 9, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants