Skip to content

Commit

Permalink
Merge pull request #316 from mkls/windows-path-bug
Browse files Browse the repository at this point in the history
Fix for not showing path for error messages on windows
  • Loading branch information
ljharb authored Sep 6, 2016
2 parents bc6ecea + baca83c commit d11bb14
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 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
2 changes: 1 addition & 1 deletion test/require.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ function tape(args) {
var proc = require('child_process')
var bin = __dirname + '/../bin/tape'

return proc.spawn(bin, args.split(' '), { cwd: __dirname })
return proc.spawn('node', [bin].concat(args.split(' ')), { cwd: __dirname })
}
2 changes: 1 addition & 1 deletion test/require/a.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var tape = require('../..');

tape.test('module-a', function(t) {
t.plan(1)
t.pass('loaded module a')
t.end()
})

global.module_a = true
2 changes: 1 addition & 1 deletion test/require/b.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var tape = require('../..');

tape.test('module-b', function(t) {
t.plan(1)
t.pass('loaded module b')
t.end()
})

global.module_b = true

0 comments on commit d11bb14

Please sign in to comment.