Skip to content

test: fix line numbers in stack traces#5664

Open
jedwards1211 wants to merge 6 commits intomochajs:mainfrom
jedwards1211:fix-nyc-source-maps
Open

test: fix line numbers in stack traces#5664
jedwards1211 wants to merge 6 commits intomochajs:mainfrom
jedwards1211:fix-nyc-source-maps

Conversation

@jedwards1211
Copy link
Copy Markdown
Contributor

PR Checklist

Overview

Changes the test scripts to run nyc with NODE_OPTIONS=--enable-source-maps so that Node will apply source maps to stack traces.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Hi @jedwards1211, thanks for the pull request! A scan flagged a concern with it. Could you please take a look?

[pr-task-completion] This PR's body is missing [x] checks on the following tasks from the PR template.

Repositories often provide a set of tasks that pull request authors are expected to complete. Those tasks should be marked as completed with a [x] in the pull request description. Please complete those tasks and mark the checks as [x] completed.

🗺️ This message was posted automatically by OctoGuide: a bot for GitHub repository best practices.

@mark-wiemer
Copy link
Copy Markdown
Member

mark-wiemer commented Jan 29, 2026

This seems helpful :) I don't have much capacity right now but will check this out when I do. Thanks for your continued contributions, I appreciate the backing issue as well :)

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.76%. Comparing base (e15bbda) to head (4761e84).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5664      +/-   ##
==========================================
+ Coverage   89.71%   89.76%   +0.05%     
==========================================
  Files          64       65       +1     
  Lines        4695     4699       +4     
  Branches      978      978              
==========================================
+ Hits         4212     4218       +6     
+ Misses        483      481       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@jedwards1211
Copy link
Copy Markdown
Contributor Author

okay no rush! This failed because I forgot to use cross-env

@mark-wiemer
Copy link
Copy Markdown
Member

any chance we can get a unit test for this change? I know it's super meta, just want to make sure we're covering our bases. If it seems infeasible, that's fine

@jedwards1211
Copy link
Copy Markdown
Contributor Author

Yeah that wouldn't be difficult

NOTE: the nyc config to unexclude failing-sync.fixture.js from instrumentation is
essential, without it the test would fail to catch any issues with stack traces.
Copy link
Copy Markdown
Contributor Author

@jedwards1211 jedwards1211 left a comment

Choose a reason for hiding this comment

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

@mark-wiemer I had to un-exclude this fixture from instrumentation in the nyc config for the sake of the test:

    "!test/integration/fixtures/failing-sync.fixture.js"

I wish I could put comments in that file because if someone thinks "what is this for??" and removes this line,
then the test will no longer be able to catch issues with the stack traces. I put an explanation in the commit
message at least

@mark-wiemer
Copy link
Copy Markdown
Member

Appreciate it. I think it should be fine, we're very careful about removing anything, and we'd definitely reference this PR and any other mentions of the file before removing it. Are you able to add comments to the fixture.js file explaining what it's for?

@jedwards1211
Copy link
Copy Markdown
Contributor Author

jedwards1211 commented Feb 1, 2026

Actually that's an existing fixture for another test that I repurposed. Maybe I should make one just for this test?

@mark-wiemer
Copy link
Copy Markdown
Member

Making a new fixture is probably best, yes :)

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

👋 @jedwards1211 are you waiting on us for anything still?

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author waiting on response from OP or other posters - more information needed label Apr 7, 2026
@jedwards1211
Copy link
Copy Markdown
Contributor Author

No, do y'all need anything from me?

@jedwards1211
Copy link
Copy Markdown
Contributor Author

Oh sorry, looks like i forgot to make some minor changes

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

Labels

status: waiting for author waiting on response from OP or other posters - more information needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🛠️ Repo: line numbers are wrong in stack traces when running mocha self tests

3 participants