-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
test: for hasItems method in FreeList #27588
test: for hasItems method in FreeList #27588
Conversation
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.
LGTM but I'd still prefer we use the public APIs rather than add to tests that dig into internal flag-protected APIs like this. For example, this could be exercised with require('_http_common').parsers.hasItems()
.
@Trott , |
I think it's fine to test an internal utility in this way. |
I do agree with @Trott that it would be better to test these things with public APIs. Otherwise it's difficult to detect actual dead code by looking at coverage reports. It gives the false impression that it's used while the code branch might not ever be reached with our actual code. Somewhat similar about the coverage it results in: testing internal functionalities directly instead of using public APIs might take different code paths and thus result in errors even though it seems fully tested. In this specific case it seems fine but in general I would like to reduce testing internals directly. |
@BridgeAR , |
Landed in ac56dc9. |
PR-URL: nodejs#27588 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
PR-URL: #27588 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
The internal freelist `hasItems()` test use the internal API directly. This commit changes them to use the API as it is exposed publicly. It tests the same code paths, but does it without needing `--expose-internals`. Refs: nodejs#27588 (review)
This PR is for missing tests for
hasItems()
method in/internal/freelist.js
.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes