-
Notifications
You must be signed in to change notification settings - Fork 335
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
Support beforeInitialisation()
options, multiple modules
#4330
Conversation
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for e9842b7 |
80f206d
to
98d6aff
Compare
98d6aff
to
f87ed4e
Compare
Adds a new `context` browser option using `@template` to “carry through” the types used in tests into `beforeInitialisation()` parameters
For example, test HTML with two buttons will now see both initialised
For example, test HTML with multiple components will only match the one being tested
f87ed4e
to
e9842b7
Compare
new namespace[exportName]($module, options.config) | ||
// Loop and initialise all $modules or use default | ||
// selector `null` return value when none found | ||
;($modules.length ? $modules : [null]).forEach( |
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.
Is this semi-colon doing something fancy?
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 caught me out too
It's a Prettier protection against those parentheses ()
becoming a function call
https://prettier.io/docs/en/rationale#semicolons
ESLint does it too but not nearly as much
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.
Ah, fair enough.
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.
I really like this, enables a lot more shenanigans before we actually run the test, and lays the ground for removing the Review app from tests in the future if we want to.
One tiny comment which I think is either a typo or is doing something I don't understand, but otherwise hot to trot.
Support `beforeInitialisation()` options, multiple modules
This PR is split out from #4266 and includes:
beforeInitialisation()
browser options$modules
being initialised inrenderAndInitialise()
This follows a "Custom Puppeteer browser options" discussion on Slack and first suggested by @romaricpascal
Custom initialisation example
Render a single button but clone it before both are initialised together