@@ -359,10 +359,10 @@ class TestContext {
359359 this . #test. todo ( message ) ;
360360 }
361361
362- #runTest( name , options , fn ) {
362+ #runTest( name , options , fn , loc ) {
363363 const overrides = {
364364 __proto__ : null ,
365- loc : getCallerLocation ( ) ,
365+ loc,
366366 } ;
367367
368368 const { plan } = this . #test;
@@ -378,12 +378,39 @@ class TestContext {
378378 return subtest . start ( ) ;
379379 }
380380
381- test = ObjectAssign ( ( ...args ) => this . #runTest( ...args ) , {
381+ // [1] `getCallerLocation` cannot be nested (that causes it to cite the nested location instead).
382+
383+ test = ObjectAssign ( ( name , options , fn ) => this . #runTest(
384+ name ,
385+ options ,
386+ fn ,
387+ getCallerLocation ( ) , // [1]
388+ ) , {
382389 __proto__ : null ,
383- expectFailure : ( name , opts , fn ) => this . #runTest( name , { __proto__ : null , ...opts , expectFailure : true } , fn ) ,
384- only : ( name , opts , fn ) => this . #runTest( name , { __proto__ : null , ...opts , only : true } , fn ) ,
385- skip : ( name , opts , fn ) => this . #runTest( name , { __proto__ : null , ...opts , skip : true } , fn ) ,
386- todo : ( name , opts , fn ) => this . #runTest( name , { __proto__ : null , ...opts , todo : true } , fn ) ,
390+ expectFailure : ( name , opts , fn ) => this . #runTest(
391+ name ,
392+ { __proto__ : null , ...opts , expectFailure : true } ,
393+ fn ,
394+ getCallerLocation ( ) , // [1]
395+ ) ,
396+ only : ( name , opts , fn ) => this . #runTest(
397+ name ,
398+ { __proto__ : null , ...opts , only : true } ,
399+ fn ,
400+ getCallerLocation ( ) , // [1]
401+ ) ,
402+ skip : ( name , opts , fn ) => this . #runTest(
403+ name ,
404+ { __proto__ : null , ...opts , skip : true } ,
405+ fn ,
406+ getCallerLocation ( ) , // [1]
407+ ) ,
408+ todo : ( name , opts , fn ) => this . #runTest(
409+ name ,
410+ { __proto__ : null , ...opts , todo : true } ,
411+ fn ,
412+ getCallerLocation ( ) , // [1]
413+ ) ,
387414 } ) ;
388415
389416 before ( fn , options ) {
0 commit comments