Skip to content

src,test: fix config file parsing for flags defaulted to true #59110

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

Merged

Conversation

geeksilva97
Copy link
Contributor

@geeksilva97 geeksilva97 commented Jul 18, 2025

Fixes #58929

This PR fixes config file parsing for boolean options that are enabled by default.

In my last PR, I did a quick fix for boolean values. Such a fix missed the case where the flag is true by default, as --warnings. To ensure we're disabling a flag, we have to output that flag prefixed with --no-.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/config

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. config Issues or PRs related to the config subsystem needs-ci PRs that need a full CI run. labels Jul 18, 2025
@geeksilva97 geeksilva97 force-pushed the fix-config-file-parsing-for-boolean branch from 50c110b to 377dcb3 Compare July 18, 2025 04:34
@geeksilva97 geeksilva97 added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 18, 2025
@geeksilva97 geeksilva97 force-pushed the fix-config-file-parsing-for-boolean branch from ce7ca6f to 99ef802 Compare July 18, 2025 04:39
@geeksilva97 geeksilva97 changed the title src,test: fix configuration file parsing for boolean configs enabled … src,test: fix config file parsing for flags defaulted to true Jul 18, 2025
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jul 18, 2025
Copy link
Contributor

Failed to start CI
   ⚠  No approving reviews found
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/16362374774

@marco-ippolito marco-ippolito requested a review from pmarchini July 18, 2025 04:56
@marco-ippolito marco-ippolito removed the request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. label Jul 18, 2025
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.05%. Comparing base (48fff6b) to head (99ef802).
Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59110      +/-   ##
==========================================
- Coverage   90.05%   90.05%   -0.01%     
==========================================
  Files         645      645              
  Lines      189153   189155       +2     
  Branches    37093    37100       +7     
==========================================
- Hits       170339   170338       -1     
- Misses      11518    11523       +5     
+ Partials     7296     7294       -2     
Files with missing lines Coverage Δ
src/node_config_file.cc 80.76% <100.00%> (+0.21%) ⬆️

... and 22 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.

@pmarchini pmarchini self-requested a review July 18, 2025 05:30
@geeksilva97 geeksilva97 added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 18, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 18, 2025
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

@geeksilva97 geeksilva97 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 18, 2025
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@JakobJingleheimer JakobJingleheimer left a comment

Choose a reason for hiding this comment

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

W00t, thanks!

@geeksilva97 geeksilva97 added commit-queue Add this label to land a pull request using GitHub Actions. and removed needs-ci PRs that need a full CI run. labels Jul 18, 2025
Comment on lines +63 to +65
test('should parse boolean flag defaulted to true', async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-config-file',
Copy link
Member

Choose a reason for hiding this comment

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

Very minor nit: we can also expose internals in order to directly verify the value of the option that we're setting. This might help decouple the option behaviour from the test. In this case, we're using the behaviour of process.emitWarning to validate that --no-warnings has been correctly managed.

Example:
https://github.com/geeksilva97/node/blob/99ef802c0031af7d0e3313cda60b6fac8471ac06/test/parallel/test-config-file.js#L479-L491

@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 20, 2025
@nodejs-github-bot nodejs-github-bot merged commit ab694d5 into nodejs:main Jul 20, 2025
63 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in ab694d5

aduh95 pushed a commit that referenced this pull request Jul 21, 2025
PR-URL: #59110
Reviewed-By: Pietro Marchini <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. config Issues or PRs related to the config subsystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config File nodeOptions.warnings: false not working
7 participants