Skip to content

[Bug]: playwright-bdd depends on playwright, but it is not listed as a peer dependency (PNPM) #332

@woppa684

Description

@woppa684

Given

I've installed playwright-bdd and @playwright/test (the sole peer dependency of playwright-bdd) using PNPM.

When

I try to run bddgen

Then

I get the following error:

Error: Package "playwright" is not installed.
    at resolvePackageRoot (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]_@[email protected]\node_modules\playwright-bdd\src\utils\index.ts:28:11)
    at getPlaywrightRoot (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]_@[email protected]\node_modules\playwright-bdd\src\playwright\utils.ts:23:40)
    at getPlaywrightModulePath (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]_@[email protected]\node_modules\playwright-bdd\src\playwright\utils.ts:18:20)
    at requirePlaywrightModule (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]_@[email protected]\node_modules\playwright-bdd\src\playwright\utils.ts:13:62)
    at resolveConfigFile (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]_@[email protected]\node_modules\playwright-bdd\src\playwright\loadConfig.ts:31:79)
    at resolveConfigDir (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]_@[email protected]\node_modules\playwright-bdd\src\playwright\loadConfig.ts:26:39)
    at defineBddConfig (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]_@[email protected]\node_modules\playwright-bdd\src\config\index.ts:30:81)      
    at file:///C:/Repos/MyRepo/.bdd/bootstrapper/config/playwright.config.ts:6:17
    at ModuleJob.run (node:internal/modules/esm/module_job:263:25)
    at ModuleLoader.import (node:internal/modules/esm/loader:540:24)
    at requireOrImport (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]\node_modules\playwright\lib\transform\transform.js:214:12)
    at loadUserConfig (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]\node_modules\playwright\lib\common\configLoader.js:106:46)
    at loadConfig (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]\node_modules\playwright\lib\common\configLoader.js:118:22)
    at loadConfigFromFile (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]\node_modules\playwright\lib\common\configLoader.js:330:10)
    at runTests (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]\node_modules\playwright\lib\program.js:166:18)
    at i.<anonymous> (C:\Repos\MyRepo\node_modules\.pnpm\[email protected]\node_modules\playwright\lib\program.js:65:7)

Expected Result

Either playwright is a peer dependency of playwright-bdd, or playwright-bdd uses only direct functionality of @playwright/test. PNPM only installs direct (peer-)dependencies in a place where require.resolve can find them. Playwright works fine on its own by only installing @playwright/test as a direct dependency.

Reproduction Demo URL

No response

Environment

Playwright-bdd environment info:

platform: win32
node: v20.19.1
playwright-bdd: v8.3.1
@playwright/test: v1.54.2
@cucumber/cucumber: v11.3.0
C:\Repos\MyRepo\node_modules\.pnpm\p[email protected]_@[email protected]\node_modules\playwright-bdd\dist\utils\index.js:49
        throw new Error(`Package "${packageName}" is not installed.`);
        ^

Error: Package "playwright" is not installed.

...

Workaround for now is to manually install the corresponding playwright version of course.

Priority Level

Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions