@@ -482,7 +482,7 @@ Test.prototype._assert = function assert(ok, opts) {
482482 if ( ! ok ) {
483483 var e = new Error ( 'exception' ) ;
484484 var err = $split ( e . stack || '' , '\n' ) ;
485- var dir = __dirname + path . sep ;
485+ var tapeDir = __dirname + path . sep ;
486486
487487 for ( var i = 0 ; i < err . length ; i ++ ) {
488488 /*
@@ -521,17 +521,35 @@ Test.prototype._assert = function assert(ok, opts) {
521521 /((?:\/|[a-zA-Z]:\\)[^:\)]+:(\d+)(?::(\d+))?)\)?/
522522 */
523523 var re = / ^ (?: [ ^ \s ] * \s * \b a t \s + ) (?: ( .* ) \s + \( ) ? ( (?: \/ | [ a - z A - Z ] : \\ ) [ ^ : ) ] + : ( \d + ) (?: : ( \d + ) ) ? ) \) ? $ / ;
524- var lineWithTokens = $replace ( $replace ( err [ i ] , process . cwd ( ) , '/$CWD' ) , __dirname , '/$TEST' ) ;
524+ // first tokenize the PWD, then tokenize tape
525+ var lineWithTokens = $replace (
526+ $replace (
527+ err [ i ] ,
528+ process . cwd ( ) ,
529+ path . sep + '$CWD'
530+ ) ,
531+ tapeDir ,
532+ path . sep + '$TEST' + path . sep
533+ ) ;
525534 var m = re . exec ( lineWithTokens ) ;
526535
527536 if ( ! m ) {
528537 continue ;
529538 }
530539
531540 var callDescription = m [ 1 ] || '<anonymous>' ;
532- var filePath = $replace ( $replace ( m [ 2 ] , '/$CWD' , process . cwd ( ) ) , '/$TEST' , __dirname ) ;
533-
534- if ( $strSlice ( filePath , 0 , dir . length ) === dir ) {
541+ // first untokenize tape, and then untokenize the PWD, then strip the line/column
542+ var filePath = $replace (
543+ $replace (
544+ $replace ( m [ 2 ] , path . sep + '$TEST' + path . sep , tapeDir ) ,
545+ path . sep + '$CWD' ,
546+ process . cwd ( )
547+ ) ,
548+ / : \d + : \d + $ / ,
549+ ''
550+ ) ;
551+
552+ if ( $strSlice ( filePath , 0 , tapeDir . length ) === tapeDir ) {
535553 continue ;
536554 }
537555
@@ -542,7 +560,7 @@ Test.prototype._assert = function assert(ok, opts) {
542560 res . line = Number ( m [ 3 ] ) ;
543561 if ( m [ 4 ] ) { res . column = Number ( m [ 4 ] ) ; }
544562
545- res . at = callDescription + ' (' + filePath + ')' ;
563+ res . at = callDescription + ' (' + filePath + ':' + res . line + ( res . column ? ':' + res . column : '' ) + ' )';
546564 break ;
547565 }
548566 }
0 commit comments