-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
feat(jest-environment): Support configuration of happy-dom with testEnvironmentOptions #1287
feat(jest-environment): Support configuration of happy-dom with testEnvironmentOptions #1287
Conversation
5d37e60
to
44d2fd9
Compare
…nvironmentOptions
dc53c5e
to
ff9b0ed
Compare
…ronmentOptions directly to the Window constructor
…ronmentOptions directly to the Window constructor
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.
Thank you for your contribution @Codex-! 🌟
I changed the solution to something simpler that I don't think will require any unit tests for now.
Instead of setting each option on the "window.happyDOM" property, I changed so that the object is sent into the Window constructor directly instead.
I hope you are fine with the solution 🙂
I did consider this but went the route of offering feedback to the consumer should the configuration be invalid. If you typo a key or use an invalid option, does this get bubbled up by happydom still?
It's simpler but at the cost of providing feedback to the consumer, and forces The usage of I feel as though it should respect the setting specified in the config instead of being force disabled https://github.com/capricorn86/happy-dom/pull/1287/files#diff-ca9251b53f292fc136910984f98fa20367077cf2f260010ca5cf707d047a6a69R57 Flipping it to: settings: {
errorCapture: BrowserErrorCaptureEnum.disabled,
...(<IOptionalBrowserSettings>projectConfig.testEnvironmentOptions?.settings)
} Would respect the user-defined option for this |
I think that it is probably better to add the validation of the settings in I put |
This PR allows users of
@happy-dom/jest-environment
to pass through non-deprecated configuration options fromIBrowserSettings
to happy-dom viatestEnvironmentOptions
in the jest config.This retains the existing behaviour of setting the default localhost URL on the instance.
Looking into testing, since the existing tests for this package are configured more like integration tests what would your preferred testing situation be? I add unit tests and set that up for this package to test those? Or add a new integration suite?