Skip to content

Commit 26e8113

Browse files
committed
[Tests] handle carriage returns in stack traces on Windows
See #571 (comment)
1 parent b445a2b commit 26e8113

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/common.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var stripChangingData = function (line) {
4747

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

5353
if (m && m[1].slice(0, 5) !== '$TEST') {
@@ -75,9 +75,9 @@ module.exports.stripFullStack = function (output) {
7575
'at$1 $2<anonymous>'
7676
).replace(
7777
// Handle stack trace variation in Node v0.8
78-
/(\[\.\.\. stack stripped \.\.\.\]\n *at) <anonymous> \(([^)]+)\)/g,
78+
/(\[\.\.\. stack stripped \.\.\.\]\r?\n *at) <anonymous> \(([^)]+)\)/g,
7979
'$1 $2'
80-
).split('\n');
80+
).split(/\r?\n/g);
8181
};
8282

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

0 commit comments

Comments
 (0)