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

fix: add client.overlay.runtimeErrors options #4773

Merged

Conversation

malcolm-kee
Copy link
Contributor

@malcolm-kee malcolm-kee commented Mar 16, 2023

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

Reported in #4771

fixes #4774
fixes #4771

  • Added client.overlay.runtimeErrors options - default to true.

For Bugs and Features; did you add new tests?

Motivation / Use-Case

Breaking Changes

Additional Info

@malcolm-kee
Copy link
Contributor Author

@alexander-akait I added the fix and verified it by testing it manually.

If automated test is a must-have I'll have to do it tomorrow as I'm very tired now (it's 3am here).

@codecov
Copy link

codecov bot commented Mar 16, 2023

Codecov Report

Patch coverage: 80.00% and project coverage change: -1.68 ⚠️

Comparison is base (cf7b0db) 92.10% compared to head (a17765a) 90.43%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4773      +/-   ##
==========================================
- Coverage   92.10%   90.43%   -1.68%     
==========================================
  Files          16       16              
  Lines        1659     1662       +3     
  Branches      618      622       +4     
==========================================
- Hits         1528     1503      -25     
- Misses        120      145      +25     
- Partials       11       14       +3     
Impacted Files Coverage Δ
bin/cli-flags.js 100.00% <ø> (ø)
lib/Server.js 91.65% <ø> (-2.03%) ⬇️
client-src/index.js 81.10% <80.00%> (-0.35%) ⬇️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

const overlay = createOverlay({
trustedTypesPolicyName,
});
const overlay = options.overlay

Choose a reason for hiding this comment

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

@malcolm-kee this is not sufficient. You are only checking if options.overlay is truthy. All options need to be passed into the createOverlay() function. The overlay options are errors: boolean & warnings: boolean.

Then, the show() function in overlay.js needs to check if the type is "warning" or "error" and compare the passed options.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@crobinson42 good catch!

I just pushed a fix so that runtime error check the options as well.

For build error/warning, it's already handled:

Copy link
Member

Choose a reason for hiding this comment

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

Testa are failed, can you look what is wrong (no rush), I think today after rest we will fix all issues

typeof options.overlay === "object"
? {
trustedTypesPolicyName: options.overlay.trustedTypesPolicyName,
catchRuntimeError: options.overlay.errors,
Copy link
Member

Choose a reason for hiding this comment

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

Also ideally we need a new option for such stuff, i.e. catchRuntimeError, because as you can see some application works in very differents envs and it can be errors outside own application

@@ -80,6 +80,7 @@ if (parsedResourceQuery.overlay) {
options.overlay = {
errors: true,
warnings: true,
runtimeErrors: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Default it to true.

@malcolm-kee malcolm-kee changed the title fix: respect overlay options fix: add client.overlay.runtimeErrors options Mar 17, 2023
@malcolm-kee
Copy link
Contributor Author

@alexander-akait I'm having problem to run the test for webpack5 to update snapshot. I tried to run it it will stuck without any reason. It's the same with master branch so my setup has issue. 😅

@alexander-akait
Copy link
Member

I will update tests don't worry

@alexander-akait alexander-akait merged commit dca2366 into webpack:master Mar 17, 2023
65 of 67 checks passed
@malcolm-kee malcolm-kee deleted the fix/respect-overlay-options branch March 17, 2023 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants