Skip to content

Commit 7536fba

Browse files
committed
Fix for not showing path for error messages on windows
This bug has been around for a while now. Tried to keep changes to the bare minimum.
1 parent bc6ecea commit 7536fba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Test.prototype._assert = function assert (ok, opts) {
217217
if (!ok) {
218218
var e = new Error('exception');
219219
var err = (e.stack || '').split('\n');
220-
var dir = path.dirname(__dirname) + '/';
220+
var dir = path.dirname(__dirname) + path.sep;
221221

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

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

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

236236
if (!filem) {
237237
continue;

0 commit comments

Comments
 (0)