Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be more general in stripping off stack frames to fix Firefox tests #2425

Merged
merged 2 commits into from Jan 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions test/assert-test.js
Expand Up @@ -1438,9 +1438,15 @@ describe("assert", function () {
[].slice.call(arguments, 1)
);
} catch (e) {
// We sometimes append stack frames to the message and they
// make assertions messy, so strip those off here
return e.message.replace(/( at.*\(.*\)$)+/gm, "");
/* We sometimes append stack frames to the message and they
* make assertions messy, so strip those off here
*
* In the regex we assume that a stack frame will have at
* least one "special character" (not a word or space) and
* use that to make sure we don't strip off the end of
* legitimate messages that end with "at least once..."
*/
return e.message.replace(/ at.*?[^\w\s].*/g, "");
}
};
});
Expand Down