util: fix styleText to accept format aliases#62191
Closed
himself65 wants to merge 1 commit intonodejs:mainfrom
Closed
util: fix styleText to accept format aliases#62191himself65 wants to merge 1 commit intonodejs:mainfrom
himself65 wants to merge 1 commit intonodejs:mainfrom
Conversation
The optimization in nodejs#61792 introduced a style cache using ObjectKeys(inspect.colors), which only returns enumerable properties. Color aliases (e.g. 'grey', 'blackBright', 'faint') are defined as non-enumerable via defineColorAlias(), so they were excluded from the cache, causing ERR_INVALID_ARG_VALUE when used with styleText(). Replace ObjectKeys with ObjectGetOwnPropertyNames to include non-enumerable alias properties in both the style cache and the validation error message. Fixes: nodejs#62177
Contributor
Failed to start CIβ No approving reviews found β Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/22922894129 |
Member
|
Duplicate of #62180. |
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62191 +/- ##
==========================================
- Coverage 89.66% 89.65% -0.01%
==========================================
Files 676 676
Lines 206550 206551 +1
Branches 39546 39544 -2
==========================================
- Hits 185198 185190 -8
- Misses 13478 13482 +4
- Partials 7874 7879 +5
π New features to boost your workflow:
|
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 optimization in #61792 introduced a style cache using ObjectKeys(inspect.colors), which only returns enumerable properties. Color aliases (e.g. 'grey', 'blackBright', 'faint') are defined as non-enumerable via defineColorAlias(), so they were excluded from the cache, causing ERR_INVALID_ARG_VALUE when used with styleText().
Replace ObjectKeys with ObjectGetOwnPropertyNames to include non-enumerable alias properties in both the style cache and the validation error message.
Fixes: #62177