Skip to content

util: preserve function names without source map names - #65108

Open
privatenumber wants to merge 1 commit into
nodejs:mainfrom
privatenumber:fix-util-getcallsites-source-map-name
Open

util: preserve function names without source map names#65108
privatenumber wants to merge 1 commit into
nodejs:mainfrom
privatenumber:fix-util-getcallsites-source-map-name

Conversation

@privatenumber

Copy link
Copy Markdown
Contributor

Problem

util.getCallSites({ sourceMap: true }) replaced a generated function name with an empty string when a valid source map omitted a name segment. Source-map names are optional, so tooling that consumes mapped call sites loses useful stack context.

For example, a generated foo() call mapped by a source map with an empty names array reported functionName: '' instead of functionName: 'foo'.

Changes

Preserve the V8 function name when the source map does not provide a replacement, matching Node.js's source-mapped stack-trace behavior. A regression fixture covers source maps with no name entries.

Fixes: #65104

Signed-off-by: Hiroki Osame <hiroki.osame@gmail.com>
@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 Aug 7, 2026
@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 7, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 7, 2026
@nodejs-github-bot

This comment has been minimized.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.31%. Comparing base (e2d7b34) to head (bdae980).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65108      +/-   ##
==========================================
- Coverage   90.31%   90.31%   -0.01%     
==========================================
  Files         759      759              
  Lines      248290   248289       -1     
  Branches    46859    46861       +2     
==========================================
- Hits       224241   224232       -9     
+ Misses      15472    15468       -4     
- Partials     8577     8589      +12     
Files with missing lines Coverage Δ
lib/util.js 100.00% <100.00%> (ø)

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

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lts-watch-v22.x PRs that may need to be released in v22.x 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.

util.getCallSites() drops functionName when a source map has no name entry

5 participants