-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Scripts: Fork jest-environment-puppeteer to use puppeteer-core directly #29418
Conversation
testMatch: [ '**/specs/**/*.[jt]s', '**/?(*.)spec.[jt]s' ], | ||
testPathIgnorePatterns: [ '/node_modules/' ], | ||
reporters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer use Travis so this code is not used. I also don't think that travis-fold-passes-reporter.js
file is still present in the Jest preset.
return require( 'puppeteer-core' ); | ||
} | ||
case 'firefox': | ||
return require( 'puppeteer-firefox' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside:
I have just learned that https://www.npmjs.com/package/puppeteer-firefox is deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's now integrated into puppeteer
proper, and can be run via the --puppeteer-product=firefox
arg, see e.g. #28498.
We could drop this case
branch (which amounts to re-organizing -- or even dropping -- the whole getPuppeteer
function).
Size Change: +9.8 kB (+1%) Total Size: 1.4 MB
ℹ️ View Unchanged
|
Can you explain why we needed the Alternatively: AFAIU, the main reason for using |
As noted in the description:
The patch referenced removes the hard dependency on
Yes, that's the main reason. It's inconvenient to teach all projects to use the flag you mentioned in their setup to avoid downloading Chromium. There is no simple way to define the same flag on the |
Yes, I read that before asking my question. Maybe you meant to point me to smooth-code/jest-puppeteer#315 specifically? Upon reading that PR's diff, I see that current versions of puppeteer have an explicit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good overall -- thanks a lot for tackling this!
I left one note which we should probably address prior to merging this -- otherwise I think it's ready.
In the future, we might consider trimming down our copy of jest-environment-puppeteer
further, or replace it by a simpler stub, as e.g. demonstrated at https://jestjs.io/docs/en/puppeteer#custom-example-without-jest-puppeteer-preset.
Yes, we should consider both options. It would be a breaking change but we can always leave a note in the CHANGELOG how to update projects. For now, by using a copy of |
Description
https://github.com/smooth-code/jest-puppeteer didn't get any updates in the last 15 months even though there were a few enhancements merged. The repository is still looking for maintainers. One of the merged changes would allow us to avoid using an npm alias
puppeteer
forpuppeteer-core
: argos-ci/jest-puppeteer#315. There are reports of issues with npm aliases used as dependencies in packages published to npm, see #21872.I did some explorations and it looks like we mostly need the latest version
jest-environment-puppeteer
. I thought that since it's only 3 files, we could as well fork this package and inline it in the@wordpress/scripts
package. This way we no longer need to use the npm alias forpuppeteer
and we should be able to have better control over the e2e configuration.I included the copyright note in all ported files:
How has this been tested?
npm run test-e2e
still works.Types of changes
Enhancement.
Checklist: