Here is a simple repository to highlight the issues using playwright in shared packages using npm workspaces:
In vscode, with the playwright extension installed, to version v1.1.7
Here is the breakdown of the workspace:
-
packages/app-1
A simple typescript library, which has a single test using playwright -
packages/shared
A simple typescript library, which exports a simple function, used bypackages/app-1
There are two branches in the repository, each of which will have its own ReadMe
explaining what to expect:
main
, which has a vanilla playwright configuration; it is only used in a single package of the workspace (app-1
).shared-fixture
, which demonstrates the issue exporting fixtures from a shared package in a workspace.
π¨ Note, when switching branches, make sure to clean the repo and re-install dependencies with the following commands:
# From root of the repo
[me@machine playwright-shared] npm clean
...
[me@machine playwright-shared] npm install
...
- Install dependencies
# from root of the repo
[me@machine playwright-shared] npm install
- Run the tests
# from root of the repo
[me@machine playwright-shared] npm run test
-
Playwright extension version used:
v1.1.7
-
Doctor output:
Liam.Lamb in playwright-shared on ξ master is π¦ v1.0.0 via ξ
β― npm doctor
Connecting to the registry
Ok
Checking npm version
Ok
current: v10.9.0, latest: v10.9.0
Checking node version
Ok
current: v20.18.0, recommended: v20.18.0
Checking configured npm registry
Ok
using default registry (https://registry.npmjs.org/)
Checking for git executable in PATH
Ok
C:\Program Files\Git\cmd\git.EXE
Checking for global bin folder in PATH
Ok
C:\Program Files\nodejs
- Workspace packages:
Liam.Lamb in playwright-shared on ξ master is π¦ v1.0.0 via ξ
β― npm ls --workspaces
[email protected] C:\Projects\Github\playwright-shared
βββ¬ [email protected] -> .\packages\app-1
β βββ @playwright/[email protected]
β βββ [email protected] deduped -> .\packages\shared
βββ [email protected] -> .\packages\shared