Skip to content

Commit

Permalink
[Tests] fix stack differences on node 0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 4, 2016
1 parent 9302682 commit c7859a2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports.getDiag = function (body) {
// placeholder $TEST variable.
// 2) Line positions within the file might change. We handle this by replacing
// line and column markers with placeholder $LINE and $COL "variables"
// a) node 0.8 does not provide nested eval line numbers, so we remove them
// 3) Stacks themselves change frequently with refactoring. We've even run into
// issues with node library refactorings "breaking" stack traces. Most of
// these changes are irrelevant to the tests themselves. To counter this, we
Expand All @@ -35,7 +36,8 @@ module.exports.stripFullStack = function (output) {
var stripChangingData = function (line) {
var withoutDirectory = line.replace(__dirname, '$TEST');
var withoutLineNumbers = withoutDirectory.replace(/:\d+:\d+/g, ':$LINE:$COL');
return withoutLineNumbers;
var withoutNestedLineNumbers = withoutLineNumbers.replace(/, \<anonymous\>:\$LINE:\$COL\)$/, ')');
return withoutNestedLineNumbers;
}

if (m) {
Expand Down
4 changes: 2 additions & 2 deletions test/exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ tap.test('exit fail', function (t) {
' Error: should be equivalent',
' [... stack stripped ...]',
' at $TEST/exit/fail.js:$LINE:$COL',
' at eval (eval at <anonymous> ($TEST/exit/fail.js:$LINE:$COL), <anonymous>:$LINE:$COL)',
' at eval (eval at <anonymous> ($TEST/exit/fail.js:$LINE:$COL), <anonymous>:$LINE:$COL)',
' at eval (eval at <anonymous> ($TEST/exit/fail.js:$LINE:$COL))',
' at eval (eval at <anonymous> ($TEST/exit/fail.js:$LINE:$COL))',
' at Test.<anonymous> ($TEST/exit/fail.js:$LINE:$COL)',
' [... stack stripped ...]',
' ...',
Expand Down
4 changes: 2 additions & 2 deletions test/fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ tap.test('array test', function (tt) {
' Error: should be equivalent',
' [... stack stripped ...]',
' at $TEST/fail.js:$LINE:$COL',
' at eval (eval at <anonymous> ($TEST/fail.js:$LINE:$COL), <anonymous>:$LINE:$COL)',
' at eval (eval at <anonymous> ($TEST/fail.js:$LINE:$COL), <anonymous>:$LINE:$COL)',
' at eval (eval at <anonymous> ($TEST/fail.js:$LINE:$COL))',
' at eval (eval at <anonymous> ($TEST/fail.js:$LINE:$COL))',
' at Test.<anonymous> ($TEST/fail.js:$LINE:$COL)',
' [... stack stripped ...]',
' ...',
Expand Down
4 changes: 2 additions & 2 deletions test/too_many.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ tap.test('array test', function (tt) {
' Error: plan != count',
' [... stack stripped ...]',
' at $TEST/too_many.js:$LINE:$COL',
' at eval (eval at <anonymous> ($TEST/too_many.js:$LINE:$COL), <anonymous>:$LINE:$COL)',
' at eval (eval at <anonymous> ($TEST/too_many.js:$LINE:$COL), <anonymous>:$LINE:$COL)',
' at eval (eval at <anonymous> ($TEST/too_many.js:$LINE:$COL))',
' at eval (eval at <anonymous> ($TEST/too_many.js:$LINE:$COL))',
' at Test.<anonymous> ($TEST/too_many.js:$LINE:$COL)',
' [... stack stripped ...]',
' ...',
Expand Down

0 comments on commit c7859a2

Please sign in to comment.