Skip to content

util: require validateStream === false for the styleText fast path - #67720

Open
GBra-4-669 wants to merge 1 commit into
nodejs:mainfrom
GBra-4-669:util-styletext-validate-stream
Open

GBra-4-669 wants to merge 1 commit into
nodejs:mainfrom
GBra-4-669:util-styletext-validate-stream

Conversation

@GBra-4-669

Copy link
Copy Markdown

styleText('red', 'text', { validateStream: 0 }) returned styled text instead of throwing. The single-format fast path checked validateStream for truthiness before the options were validated so a falsy non-boolean value skipped validation. Require validateStream === false for the fast path: other non-boolean values now reach validateBoolean() and throw ERR_INVALID_ARG_TYPE, false still skips stream validation and null/undefined still select the default.

Updated the benchmark's validateStream axis from [1, 0] to [true, false].

Added cases to test/parallel/test-util-styletext.js, currently failing on main.

Fixes: #67700

Signed-off-by: GBra 4.669 <35969802+GBra-4-669@users.noreply.github.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

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. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

styleText fast path bypasses options and options.validateStream validation

2 participants