Skip to content

Preserve unparsed stack trace lines in the transformed output - #39

Merged
rmuratov merged 1 commit into
mainfrom
preserve-unparsed-stack-trace-lines
Jul 11, 2026
Merged

Preserve unparsed stack trace lines in the transformed output#39
rmuratov merged 1 commit into
mainfrom
preserve-unparsed-stack-trace-lines

Conversation

@rmuratov

Copy link
Copy Markdown
Owner

Closes #28

Problem

The transformed output was fully re-generated from parsed frames, so:

  • lines the parser does not recognize (async markers, Caused by: chains, etc.) were silently dropped,
  • multi-line error messages were truncated to the first line,
  • frames without a matching source map were re-formatted instead of being left alone.

Fix

The transformation is now line-based:

  • StackTrace parses the input line by line and keeps { raw, frame } pairs (lines) instead of a detached message + frames split.
  • transform only replaces lines whose frames were successfully mapped through a source map; every other line — messages, unparsed lines, unmapped frames — passes through verbatim in its original position.

A nice consequence: with no matching source maps the output now equals the input exactly, so the reconstructed fixture (a lossy re-rendering of the stack trace) is gone. The result and afterDeleteIndex fixtures did not change.

Tests

Two new tests (unparsed lines suite): a multi-line error message survives the transformation, and an async marker plus a Caused by: chain pass through in place between mapped frames. Both fail on main without the fix (verified via git stash). Existing expectations for unmapped frames were updated to the new pass-through behavior.

Coverage stays at 100%.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sourcemap-tools with  Cloudflare Pages  Cloudflare Pages

Latest commit: a2d3894
Status: ✅  Deploy successful!
Preview URL: https://f2fc5faa.sourcemap-tools.pages.dev
Branch Preview URL: https://preserve-unparsed-stack-trac.sourcemap-tools.pages.dev

View logs

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (48c176b) to head (a2d3894).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #39   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          213       209    -4     
  Branches        53        55    +2     
=========================================
- Hits           213       209    -4     

☔ View full report in Codecov by Harness.
📢 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.

@rmuratov
rmuratov merged commit df741b3 into main Jul 11, 2026
4 checks passed
@rmuratov
rmuratov deleted the preserve-unparsed-stack-trace-lines branch July 11, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reconstructed stack trace loses information from unparsed lines

1 participant