Skip to content

Commit

Permalink
Fix Windows path support in error messages
Browse files Browse the repository at this point in the history
Supersede tape-testing#221. Fix tape-testing#220. Generally makes tape support more kinds of stacktrace formats.
  • Loading branch information
Hugo Wood committed Jul 12, 2016
1 parent fb600ee commit 845510c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Test.prototype._assert = function assert (ok, opts) {
if (!ok) {
var e = new Error('exception');
var err = (e.stack || '').split('\n');
var dir = path.dirname(__dirname) + '/';
var dir = path.dirname(__dirname) + path.sep;

for (var i = 0; i < err.length; i++) {
var m = /^[^\s]*\s*\bat\s+(.+)/.exec(err[i]);
Expand All @@ -226,12 +226,12 @@ Test.prototype._assert = function assert (ok, opts) {
}

var s = m[1].split(/\s+/);
var filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[1]);
var filem = /((?:\/|[A-Z]:\\)[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[1]);
if (!filem) {
filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[2]);
filem = /((?:\/|[A-Z]:\\)[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[2]);

if (!filem) {
filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[3]);
filem = /((?:\/|[A-Z]:\\)[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[3]);

if (!filem) {
continue;
Expand Down

0 comments on commit 845510c

Please sign in to comment.