Skip to content

Commit

Permalink
[Tests] handle stack trace variation in node <= 0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 26, 2019
1 parent d7c2fd3 commit 21ac403
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 0 additions & 6 deletions test/anonymous-fn.js
Expand Up @@ -12,12 +12,6 @@ tap.test('inside anonymous functions', function (tt) {
var tc = function (rows) {
var body = stripFullStack(rows.toString('utf8'));

// Handle stack trace variation in Node v0.8
body = body.replace(
/at(:?) Test\.module\.exports/g,
'at$1 Test.<anonymous>'
);

tt.same(body, [
'TAP version 13',
'# wrapped test failure',
Expand Down
6 changes: 5 additions & 1 deletion test/common.js
Expand Up @@ -57,5 +57,9 @@ module.exports.stripFullStack = function (output) {
return !hasPrior;
});

return deduped.join('\n');
return deduped.join('\n').replace(
// Handle stack trace variation in Node v0.8
/at(:?) Test\.(?:module\.exports|tap\.test\.err\.code)/g,
'at$1 Test.<anonymous>'
);
};

0 comments on commit 21ac403

Please sign in to comment.