Skip to content
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

Prevent Chrome headless deprecation warning #3542

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Apr 24, 2023

This PR prevents the recent Puppeteer { headless: true } deprecation warning:

We can revisit this in future with “new” headless mode via:

Until then it prevents all the console spam we're getting:

Console spam from Puppeteer

@colinrotherham colinrotherham added 🐛 bug Something isn't working the way it should (including incorrect wording in documentation) github-actions labels Apr 24, 2023
@colinrotherham colinrotherham self-assigned this Apr 24, 2023
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3542 April 24, 2023 16:09 Inactive
* {@link https://developer.chrome.com/articles/new-headless/}
*/
headless: process.env.HEADLESS !== 'false'
? undefined
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By defaulting to { headless: undefined } we skip the deprecation checks in:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@domoscargin Sadly they're using const headless = options.headless ?? true; which compiles to:

const headless = (_a = options.headless) !== null && _a !== void 0 ? _a : true;

But we can default to 1 instead of undefined to make this work

Copy link
Contributor

@domoscargin domoscargin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

@colinrotherham
Copy link
Contributor Author

I've raised this with the Puppeteer team as the intention probably wasn't to throw up 11x warnings per test run:

Prevents the warning by defaulting to `1` (not `true`) until we investigate “new” headless mode in: #3541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation)
Projects
Development

Successfully merging this pull request may close these issues.

3 participants