You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the optionalDependencies object.
optionalDependencies are like dependencies: always downloaded. the if it cannot be found does not seem to be respected. I know it sucks, this makes it pretty useless.
Problem is firefox, chromium and webkit are heavy downloads, specially for a CI (downloaded on each CI run).
Proposed solution: remove optionalDependencies and clearly states in the docs that the user should download either playwright (bundles the 3 browsers) or playwright-firefox or playwright-chromium or playwright-webkit (to be verified, this is my understanding). Maybe move playwright-core to devDependencies?
I've also experienced the issue, that even when I install only playwright-chromium on my actual repository also their friends get's installed by jest-playwright.
For me your described approach makes sense and should probably work.
PR is open, have to add docs now.
playwright-firefox, playwright-chromium and playwright-webkit always get installed
This is because they are declared as
optionalDependencies
: https://github.com/mmarkelov/jest-playwright/blob/v0.0.10/package.json#L48-L54This generates inside package-lock.json:
optionalDependencies
does not work like you think: https://docs.npmjs.com/files/package.json#optionaldependenciesoptionalDependencies
are likedependencies
: always downloaded. the if it cannot be found does not seem to be respected. I know it sucks, this makes it pretty useless.Problem is firefox, chromium and webkit are heavy downloads, specially for a CI (downloaded on each CI run).
Proposed solution: remove
optionalDependencies
and clearly states in the docs that the user should download either playwright (bundles the 3 browsers) or playwright-firefox or playwright-chromium or playwright-webkit (to be verified, this is my understanding). Maybe move playwright-core todevDependencies
?btw jest-puppeteer does not have any
optionalDependencies
: https://github.com/smooth-code/jest-puppeteer/blob/949027b1332e270fad78eda10fd1a92c56abe1b5/package.jsonbtw It's always nice to declare an empty
dependencies: {}
instead of omitting it: makes it clear when reading thepackage.json
The text was updated successfully, but these errors were encountered: