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