-
Notifications
You must be signed in to change notification settings - Fork 341
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
Ensure tests fail for browser exceptions #2933
Conversation
e2612f8
to
037225f
Compare
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.
Generally looks really good – have tested by recreating the issue we had in September (trying to access $module.dataset
when $module
was undefined) and we now get actually useful messages surfaced in the test output 🙌🏻
A minor nitpick and a suggestion for your consideration, but neither are blocking so happy to approve.
d1c486b
to
8ad0084
Compare
037225f
to
7f2745a
Compare
7f2745a
to
dc0e45b
Compare
aa59153
to
57edd77
Compare
Only three unit test files remain which still need a jsdom environment override: ``` src/govuk/common.unit.test.mjs src/govuk/components/character-count/character-count.unit.test.mjs src/govuk/i18n.unit.test.mjs ```
dc0e45b
to
a170641
Compare
This PR ensures all browser tests (Puppeteer, jsdom) fail for unhandled browser exceptions
It does a few separate things:
process.emit('error', error)
to ensure browser exceptions fail testsPrevents Jest Puppeteer incorrectly emittinguncaughtException
Update: The missing piece of the puzzle was (strangely) removing the
error.stack
property before callingprocess.emit()
. This ensures the error is logged in our test output, rather than blank linesPossibly related to jestjs/jest#6281