Skip to content

Conversation

@RafaelGSS
Copy link
Member

It seems this was missed in the PRs that added both options.


cc: @legendecas

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. util Issues and PRs related to the built-in util module. labels Sep 23, 2025
Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

#44711 didn't add a test case for sync emit deprecation. I believe the original intention was that the new option is an internal option.

I also personally believe that the public api should keep the signature util.deprecate(fn, msg[, code]) as is.

@RafaelGSS
Copy link
Member Author

#44711 didn't add a test case for sync emit deprecation. I believe the original intention was that the new option is an internal option.

I also personally believe that the public api should keep the signature util.deprecate(fn, msg[, code]) as is.

Currently, they aren't. We are exposing the same internalUtil.deprecate to util.deprecate. We could consider change that, but that's how the state of the art is.

@legendecas
Copy link
Member

Currently, they aren't. We are exposing the same internalUtil.deprecate to util.deprecate. We could consider change that, but that's how the state of the art is.

yes, you are right that internalUtil.deprecate is exposed as util.deprecate directly. Given that these positional arguments were never documented, I'm suggesting that we should change it.

@RafaelGSS
Copy link
Member Author

@legendecas the modifyPrototype specifically I'd like to have it exposed as it reduces a performance bottleneck the util.deprecate does to the deprecated object.

Since I was about to expose the modifyPrototype, I thought it might be interesting to expose the emitSync, too, as it might be valuable to other users.

What's your suggestion? Exposing both or exposing just modifyPrototype?

@legendecas
Copy link
Member

legendecas commented Sep 24, 2025

We need test coverages. I searched the test/ directory for deprecate tests, and I didn't find any coverage for emitSync and modifyPrototype.

I'd think a public API exposing these options in an option bag could be future proof. Instead of positional args.

@RafaelGSS
Copy link
Member Author

I concur.

I will adjust that.

@RafaelGSS RafaelGSS force-pushed the document-deprecate-options branch 2 times, most recently from c58f871 to 7877556 Compare October 14, 2025 15:00
@RafaelGSS RafaelGSS requested a review from legendecas October 14, 2025 15:00
@RafaelGSS RafaelGSS changed the title doc: document util.deprecate options lib: add options to util.deprecate Oct 14, 2025
@RafaelGSS RafaelGSS added semver-minor PRs that contain new features and should be released in the next minor version. needs-ci PRs that need a full CI run. and removed doc Issues and PRs related to the documentations. labels Oct 14, 2025
@RafaelGSS RafaelGSS force-pushed the document-deprecate-options branch from 7877556 to 5d320f1 Compare October 14, 2025 15:07
@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.54%. Comparing base (c9578dc) to head (5ae64ea).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59982      +/-   ##
==========================================
- Coverage   88.55%   88.54%   -0.02%     
==========================================
  Files         704      704              
  Lines      207989   207994       +5     
  Branches    40068    40076       +8     
==========================================
- Hits       184180   184158      -22     
- Misses      15841    15855      +14     
- Partials     7968     7981      +13     
Files with missing lines Coverage Δ
lib/util.js 97.97% <100.00%> (+0.01%) ⬆️

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


// Public util.deprecate API
function deprecate(fn, msg, code, { modifyPrototype } = {}) {
return internalDeprecate(fn, msg, code, undefined, modifyPrototype);
Copy link
Member

Choose a reason for hiding this comment

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

doesn't this mean it's a breaking change?

Copy link
Member

Choose a reason for hiding this comment

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

These are not a documented argument. Do you have a package in mind that will be broken by this undocumented behavior?

Copy link
Member

Choose a reason for hiding this comment

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

Nope, but whether it's documented or not generally has no effect on whether something is theoretically breaking.

Copy link
Member

Choose a reason for hiding this comment

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

We would not consider fixing an undocumented behavior as an effective breaking change if the impact is trivial. This is one of the main reason that we need a public API contract such as documentation.

@RafaelGSS RafaelGSS added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 27, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 27, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@legendecas legendecas added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 30, 2025
@RafaelGSS RafaelGSS force-pushed the document-deprecate-options branch from ab7e810 to 5ae64ea Compare November 4, 2025 00:59
@RafaelGSS
Copy link
Member Author

I had to rebase on main as OSX was failing constantly.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@RafaelGSS RafaelGSS added the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 5, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 5, 2025
@nodejs-github-bot nodejs-github-bot merged commit cfa11ba into nodejs:main Nov 5, 2025
62 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in cfa11ba

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants