async_hooks: use validateBoolean for trackPromises#64731
Open
soulee-dev wants to merge 1 commit into
Open
Conversation
The `trackPromises` check duplicated `validateBoolean()` exactly: same error code, same expected type string, same argument order. Replace it with the validator, matching how this file already validates `type` and `fn` via `validateString()`/`validateFunction()`. `ERR_INVALID_ARG_TYPE` had no other use in this file, so drop the import. Since `validateBoolean` is wrapped in `hideStackFrames()`, the thrown error is unchanged from a caller's perspective. Signed-off-by: Soul Lee <alus20x@gmail.com>
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64731 +/- ##
==========================================
- Coverage 90.14% 90.14% -0.01%
==========================================
Files 743 743
Lines 242408 242408
Branches 45656 45650 -6
==========================================
- Hits 218520 218507 -13
Misses 15387 15387
- Partials 8501 8514 +13
π New features to boost your workflow:
|
Author
|
@daeyeon Thanks for approving the CI run! The only failing check is The same
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
trackPromisesvalidation added in #61415 hand-rolls a check thatvalidateBoolean()already performs β same error code, same expected type string, same argument order. This replaces it with the validator.lib/async_hooks.jsalready importsvalidateString()andvalidateFunction()and uses them fortypeandfn, so this also makes the file internally consistent. With the last manual check gone, theERR_INVALID_ARG_TYPEimport is dropped as well.No behavior change:
validateBoolean()is wrapped inhideStackFrames(), so the thrown error is identical from a caller's perspective, including the top stack frame. The existing coverage intest/async-hooks/test-track-promises-validation.jsalready asserts this, so no new tests are added.Refs: #61415