Skip to content

Conversation

SeokhunEom
Copy link
Contributor

@SeokhunEom SeokhunEom commented Sep 4, 2025

Add test case for util._exceptionWithHostPort function to verify proper error object creation with correct properties and message formatting.

Before this PR

Files Tracked lines Covered Partial Missed Coverage %
util.js 543 532 0 11 97.97%

After this PR

Files Tracked lines Covered Partial Missed Coverage %
util.js 543 543 0 0 100.00%

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Sep 4, 2025
Add test case for util._exceptionWithHostPort function to verify
proper error object creation with correct properties and message
formatting.
@SeokhunEom SeokhunEom force-pushed the add-exceptionwithhostport-test branch from 47737f2 to 76ea289 Compare September 4, 2025 13:28
Copy link

codecov bot commented Sep 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.99%. Comparing base (3ffc3d7) to head (76ea289).
⚠️ Report is 82 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59757      +/-   ##
==========================================
+ Coverage   89.94%   89.99%   +0.04%     
==========================================
  Files         667      667              
  Lines      196782   196813      +31     
  Branches    38416    38425       +9     
==========================================
+ Hits       176997   177115     +118     
+ Misses      12228    12115     -113     
- Partials     7557     7583      +26     

see 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@daeyeon daeyeon added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Sep 8, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 8, 2025
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

The method actually seems to be unused as far as I can tell and that is the reason it is not covered by tests. I believe we should in fact just remove the code instead.

Testing internals like this is actually mostly not ideal, especially due to situations like these. It would become even more difficult to detect that code is in fact not used.

@BridgeAR BridgeAR removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 14, 2025
@SeokhunEom
Copy link
Contributor Author

The method actually seems to be unused as far as I can tell and that is the reason it is not covered by tests. I believe we should in fact just remove the code instead.

Testing internals like this is actually mostly not ideal, especially due to situations like these. It would become even more difficult to detect that code is in fact not used.

Thanks for your feedback.

As you said testing dead code isn't ideal. 
But I found _exceptionWithHostPort is referenced in _errnoException, but it appears to be a bug.
It seems _errnoException should be referencing itself in Error.captureStackTrace, not _exceptionWithHostPort.

I'll make a new PR to fix the bug and then remove the function as you suggested.

  • Quick question: We don't need a deprecation cycle for an internal (_) function like this, do we? Just wanted to be sure.

Let me know what you think of this plan. If it sounds good, I'll make a new PR for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants