Skip to content

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Oct 1, 2025

We (correctly) allow different streams to be specified for stdout and stderr, so we should also allow different inspect options for these streams.

@addaleax addaleax added semver-minor PRs that contain new features and should be released in the next minor version. console Issues and PRs related to the console subsystem. labels Oct 1, 2025
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Oct 1, 2025
We (correctly) allow different streams to be specified for `stdout`
and `stderr`, so we should also allow different inspect options for
these streams.
@addaleax addaleax force-pushed the console-inspect-options-map branch from 24ddc86 to dc89673 Compare October 1, 2025 12:31
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.43%. Comparing base (b217051) to head (dc89673).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60082      +/-   ##
==========================================
- Coverage   88.45%   88.43%   -0.03%     
==========================================
  Files         703      703              
  Lines      207797   207808      +11     
  Branches    40021    40022       +1     
==========================================
- Hits       183807   183767      -40     
- Misses      15969    16019      +50     
- Partials     8021     8022       +1     
Files with missing lines Coverage Δ
lib/internal/console/constructor.js 98.14% <100.00%> (+0.02%) ⬆️

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

[stderr, inspectOptions],
]);

for (const inspectOptions of MapPrototypeValues(inspectOptionsMap)) {
Copy link
Member

Choose a reason for hiding this comment

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

any reason not to make it a weakmap? instead of iterating over the values, you can already use stdout/stderr and hardcode the two checks, which would be faster than iterating anyways

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean ... it doesn't matter here, does it? The keys will be kept alive anyway. We could put in the effort to allow either a WeakMap or Map, but I don't think that's an option that provides much benefit

Copy link
Member

Choose a reason for hiding this comment

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

ah, you're right, since the instance holds a strong reference to the streams, and when the instance goes so does the Map, then a Map is fine.

i'd still suggest hardcoding the two checks rather than a for-of loop and the slow iteration protocol, but nbd either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
console Issues and PRs related to the console subsystem. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants