Skip to content

Commit

Permalink
[Tests] handle carriage returns in stack traces on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 15, 2021
1 parent 418dc94 commit f79acdf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/common.js
Expand Up @@ -45,7 +45,7 @@ var stripChangingData = function (line) {

module.exports.stripFullStack = function (output) {
var stripped = ' [... stack stripped ...]';
var withDuplicates = output.split('\n').map(stripChangingData).map(function (line) {
var withDuplicates = output.split(/\r?\n/g).map(stripChangingData).map(function (line) {
var m = line.match(/[ ]{8}at .*\((.*)\)/);

if (m && m[1].slice(0, 5) !== '$TEST') {
Expand Down Expand Up @@ -73,7 +73,7 @@ module.exports.stripFullStack = function (output) {
'at$1 $2<anonymous>'
).replace(
// Handle stack trace variation in Node v0.8
/(\[\.\.\. stack stripped \.\.\.\]\n *at) <anonymous> \(([^)]+)\)/g,
/(\[\.\.\. stack stripped \.\.\.\]\r?\n *at) <anonymous> \(([^)]+)\)/g,
'$1 $2'
).split('\n');
).split(/\r?\n/g);
};

0 comments on commit f79acdf

Please sign in to comment.