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 b445a2b commit 26e8113
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/common.js
Expand Up @@ -47,7 +47,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 @@ -75,9 +75,9 @@ 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);
};

module.exports.runProgram = function (folderName, fileName, cb) {
Expand Down

0 comments on commit 26e8113

Please sign in to comment.