Skip to content

fix: apply client logging options directly on client loading #2946

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

Closed
wants to merge 1 commit into from
Closed

fix: apply client logging options directly on client loading #2946

wants to merge 1 commit into from

Conversation

noelebrun
Copy link

  • 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

For Bugs and Features; did you add new tests?

Updating logs snapshots was enough to test the new expected behavior. Some client tests were refactored as a result of some refactor in the client utils.

Motivation / Use-Case

Following the issue reported in #2932, client logging options needed to be moved to initial client options (the ones passed in the entry URL query).

Breaking Changes

None

Additional Info

Since the query parsing was done directly in the socket URL generation function, it had to be moved to a separate util. This split also simplified the unit tests of those utils.

@codecov
Copy link

codecov bot commented Dec 27, 2020

Codecov Report

Merging #2946 (b90136d) into master (9e3a481) will increase coverage by 0.44%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2946      +/-   ##
==========================================
+ Coverage   92.39%   92.84%   +0.44%     
==========================================
  Files          37       38       +1     
  Lines        1263     1271       +8     
  Branches      328      330       +2     
==========================================
+ Hits         1167     1180      +13     
+ Misses         91       87       -4     
+ Partials        5        4       -1     
Impacted Files Coverage Δ
lib/Server.js 94.86% <ø> (-0.03%) ⬇️
client-src/default/index.js 97.82% <100.00%> (+5.35%) ⬆️
client-src/default/utils/createSocketUrl.js 100.00% <100.00%> (ø)
client-src/default/utils/getUrlOptions.js 100.00% <100.00%> (ø)
client-src/default/utils/log.js 100.00% <100.00%> (ø)
lib/utils/DevServerPlugin.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e3a481...b90136d. Read the comment docs.

function getSocketUrl(urlParts, loc) {
function createSocketUrl(urlParts, loc) {
// Use parameter to allow passing location in unit tests
if (typeof loc === 'string' && loc !== '') {
Copy link
Member

Choose a reason for hiding this comment

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

Is it only for tests?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, it is. I kept it how it was before. (I've tried removing it and overriding self.location in the test but that didn't work. Probably because self doesn't work as expected in the test environment?)

Copy link
Member

Choose a reason for hiding this comment

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

hm, weird, self should work, jest allows to mock this

Copy link
Author

Choose a reason for hiding this comment

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

I guess that's why it has already been mocked before

Copy link
Member

Choose a reason for hiding this comment

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

I think we should avoid code for testing from runtime...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants