Skip to content

refactor: avoid new public options on class #3261

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

Merged
merged 3 commits into from
May 19, 2021
Merged

Conversation

snitin315
Copy link
Member

@snitin315 snitin315 commented May 7, 2021

  • 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?

Motivation / Use-Case

rely on this.options.host

Breaking Changes

None

Additional Info

No

@codecov
Copy link

codecov bot commented May 7, 2021

Codecov Report

Merging #3261 (d78b8f9) into master (9801377) will increase coverage by 0.13%.
The diff coverage is 86.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3261      +/-   ##
==========================================
+ Coverage   95.55%   95.68%   +0.13%     
==========================================
  Files          34       34              
  Lines        1260     1276      +16     
  Branches      357      366       +9     
==========================================
+ Hits         1204     1221      +17     
+ Misses         52       51       -1     
  Partials        4        4              
Impacted Files Coverage Δ
lib/Server.js 96.03% <86.84%> (+0.30%) ⬆️
lib/utils/normalizeOptions.js 100.00% <0.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 9801377...d78b8f9. Read the comment docs.

@snitin315 snitin315 marked this pull request as ready for review May 7, 2021 01:46
Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Good job, ideally we should add tests:

  • const devServer = new DevServer({ host: '192.168.0.2' }); devServer.listen(80, '127.0.0.1'); and throw an error like we do with the port option
  • const devServer = new DevServer({ host: '192.168.0.2' }); devServer.listen(80); should work and listen 192.168.0.2

Also I think we should support signatures like in server.listen https://nodejs.org/api/net.html#net_server_listen (except), but we can do it in separate PR

@snitin315
Copy link
Member Author

I will update 👍

@snitin315
Copy link
Member Author

const devServer = new DevServer({ host: '192.168.0.2' }); devServer.listen(80, '127.0.0.1'); and throw an error like we do with the port option

In the case of port we are just logging a warning, should we throw an error instead?

if (typeof port !== 'undefined' && port !== this.options.port) {
this.logger.warn(
'The port specified in options and the port passed as an argument is different.'
);
}

@alexander-akait
Copy link
Member

Better warning here

@snitin315 snitin315 force-pushed the refactor-code branch 4 times, most recently from 4ff9fb3 to 51cedf0 Compare May 12, 2021 02:43
@snitin315 snitin315 requested a review from alexander-akait May 12, 2021 10:28
@snitin315
Copy link
Member Author

I will fix CI in near future

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

I will test and review it in near future

@alexander-akait
Copy link
Member

@snitin315 need rebase too

@snitin315
Copy link
Member Author

Unfortunately I'm off my system, it's already night here. I will rebase in near future.

@snitin315 snitin315 force-pushed the refactor-code branch 2 times, most recently from 201920a to be57500 Compare May 16, 2021 01:40
@snitin315
Copy link
Member Author

Done ✅

@alexander-akait alexander-akait merged commit 33dc4fe into master May 19, 2021
@alexander-akait alexander-akait deleted the refactor-code branch May 19, 2021 19:09
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