Skip to content

Commit

Permalink
persist paths in stack trace which have cwd as infix
Browse files Browse the repository at this point in the history
  • Loading branch information
outsideris authored and boneskull committed Mar 5, 2018
1 parent 2c720a3 commit 5078fc5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.js
Expand Up @@ -543,7 +543,7 @@ exports.stackTraceFilter = function () {

// Clean up cwd(absolute)
if (/\(?.+:\d+:\d+\)?$/.test(line)) {
line = line.replace(cwd, '');
line = line.replace('(' + cwd, '(');
}

list.push(line);
Expand Down
17 changes: 17 additions & 0 deletions test/node-unit/stack-trace-filter.spec.js
Expand Up @@ -88,6 +88,23 @@ describe('stackTraceFilter()', function () {
expect(filter(stack.join('\n')))
.to.equal(expected.join('\n'));
});

it('should not replace absolute path which has cwd as infix', function () {
var stack = [
'Error: /www' + process.cwd() + '/bla.js has a problem',
'at foo (/www' + process.cwd() + '/foo/index.js:13:226)',
'at bar (/usr/local/dev/own/tmp/node_modules/bluebird/js/main/promise.js:11:26)'
];

var expected = [
'Error: /www' + process.cwd() + '/bla.js has a problem',
'at foo (/www' + process.cwd() + '/foo/index.js:13:226)',
'at bar (/usr/local/dev/own/tmp/node_modules/bluebird/js/main/promise.js:11:26)'
];

expect(filter(stack.join('\n')))
.to.equal(expected.join('\n'));
});
});

describe('on Windows', function () {
Expand Down

0 comments on commit 5078fc5

Please sign in to comment.