@@ -77,7 +77,7 @@ Test.prototype._setAssertError = function (err) {
7777 this . assertError = err ;
7878} ;
7979
80- Test . prototype . plan = function ( count ) {
80+ Test . prototype . plan = function ( count , planStack ) {
8181 if ( typeof count !== 'number' ) {
8282 throw new TypeError ( 'Expected a number' ) ;
8383 }
@@ -86,7 +86,7 @@ Test.prototype.plan = function (count) {
8686
8787 // in case the `planCount` doesn't match `assertCount,
8888 // we need the stack of this function to throw with a useful stack
89- this . planStack = new Error ( ) . stack ;
89+ this . planStack = planStack ;
9090} ;
9191
9292Test . prototype . _run = function ( ) {
@@ -265,7 +265,6 @@ Test.prototype._publicApi = function () {
265265
266266function PublicApi ( test ) {
267267 this . _test = test ;
268- this . plan = test . plan . bind ( test ) ;
269268 this . skip = new SkipApi ( test ) ;
270269}
271270
@@ -303,6 +302,15 @@ PublicApi.prototype = enhanceAssert({
303302 onError : onAssertionEvent
304303} ) ;
305304
305+ PublicApi . prototype . plan = function plan ( ct ) {
306+ var limitBefore = Error . stackTraceLimit ;
307+ Error . stackTraceLimit = 1 ;
308+ var obj = { } ;
309+ Error . captureStackTrace ( obj , plan ) ;
310+ Error . stackTraceLimit = limitBefore ;
311+ this . _test . plan ( ct , obj . stack ) ;
312+ } ;
313+
306314// Getters
307315[
308316 'assertCount' ,
0 commit comments