-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Only replace absolute -> relative paths for stack lines #2145
Conversation
the stack can include the error message which might contain paths that should not be replaced
afdea3d
to
dc36508
Compare
@danielstjules any comments on this? |
It looks good, but can you post the output of the code snippet from #2126 (comment) with your branch? Will take a look later tonight. |
@danielstjules it will change to
in other words: the paths in the stacktrace are still simplified, but any paths in the original error message remain the same |
@danielstjules ping |
Sorry for the delay! Confirmed that the following works as described after the PR: describe('foo', function() {
it('bar', function() {
throw new Error('this is a test in ' + process.cwd() + '/foo/bar/test.js and it fails');
});
});
Edit: Fixed output |
@@ -733,7 +733,11 @@ exports.stackTraceFilter = function() { | |||
} | |||
|
|||
// Clean up cwd(absolute) | |||
list.push(line.replace(cwd, '')); | |||
if (/\(?.+:\d+:\d+\)?$/.test(line)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the capture group for? Could this be simplified, e.g.
if (line.match(/:\d+:\d+$/)) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's actually not a capture group, those are escaped parenthesis. your suggestion would only work for stack lines without parenthesis around the file+position info, but according to the test/utils.js
both seem to exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, didn't notice the escape characters :)
Other than my comment on the regexp, looks good :) |
Only replace absolute -> relative paths for stack lines
This PR resolves #2126.