@@ -29,7 +29,7 @@ exports.expect = function (value, prefix) {
29
29
const location = at . filename + ':' + at . line + '.' + at . column ;
30
30
internals . locations [ location ] = true ;
31
31
++ internals . count ;
32
- return new internals . Assertion ( value , prefix , location ) ;
32
+ return new internals . Assertion ( value , prefix , location , at ) ;
33
33
} ;
34
34
35
35
@@ -52,11 +52,12 @@ exports.count = function () {
52
52
} ;
53
53
54
54
55
- internals . Assertion = function ( ref , prefix , location ) {
55
+ internals . Assertion = function ( ref , prefix , location , at ) {
56
56
57
57
this . _ref = ref ;
58
58
this . _prefix = prefix || '' ;
59
59
this . _location = location ;
60
+ this . _at = at ;
60
61
this . _flags = { } ;
61
62
} ;
62
63
@@ -112,7 +113,7 @@ internals.Assertion.prototype.assert = function (result, verb, actual, expected)
112
113
Error . captureStackTrace ( error , this . assert ) ;
113
114
error . actual = actual ;
114
115
error . expected = expected ;
115
- error . at = exports . thrownAt ( error ) ;
116
+ error . at = exports . thrownAt ( error ) || this . _at ;
116
117
throw error ;
117
118
} ;
118
119
@@ -522,7 +523,7 @@ exports.thrownAt = function (error) {
522
523
error = error || new Error ( ) ;
523
524
const stack = typeof error . stack === 'string' ? error . stack : '' ;
524
525
const frame = stack . replace ( error . toString ( ) , '' ) . split ( '\n' ) . slice ( 1 ) . filter ( internals . filterLocal ) [ 0 ] || '' ;
525
- const at = frame . match ( / ^ \s * a t \( ? ( .+ ) \: ( \d + ) \: ( \d + ) \) ? $ / ) ;
526
+ const at = frame . match ( / ^ \s * a t [ ^ ( ] * \( ? ( .+ ) \: ( \d + ) \: ( \d + ) \) ? $ / ) ;
526
527
return Array . isArray ( at ) ? {
527
528
filename : at [ 1 ] ,
528
529
line : at [ 2 ] ,
0 commit comments