Skip to content

Commit

Permalink
Corrently symbolicate message (facebook#48048)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#48048

Changelog: [Internal]
Some messages may contains multi line content, ie snapshot comparison, multiline strings comparison.

Fixing this by checking first code pointer in the stack and slicing from there.

Reviewed By: christophpurrer, rubennorte

Differential Revision: D66660107

fbshipit-source-id: 57cea02cf6aae3c24f351504c2e077b5a2de0761
  • Loading branch information
andrewdacenko authored and facebook-github-bot committed Dec 2, 2024
1 parent 1a9780f commit dc88683
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jest/integration/runtime/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ class ErrorWithCustomBlame extends Error {
this.#cachedProcessedStack = originalStack;
} else {
const lines = originalStack.split('\n');
lines.splice(1, this.#ignoredFrameCount);
const index = lines.findIndex(line =>
/at (.*) \((.*):(\d+):(\d+)\)/.test(line),
);
lines.splice(index > -1 ? index : 1, this.#ignoredFrameCount);
this.#cachedProcessedStack = lines.join('\n');
}
}
Expand Down

0 comments on commit dc88683

Please sign in to comment.