@@ -123,7 +123,7 @@ function lazyAssertObject(harness) {
123123 return assertObj ;
124124}
125125
126- function stopTest ( timeout , signal , reason ) {
126+ function stopTest ( timeout , signal ) {
127127 const deferred = PromiseWithResolvers ( ) ;
128128 const abortListener = addAbortListener ( signal , deferred . resolve ) ;
129129 let timer ;
@@ -141,7 +141,7 @@ function stopTest(timeout, signal, reason) {
141141 writable : true ,
142142 value : PromisePrototypeThen ( deferred . promise , ( ) => {
143143 throw new ERR_TEST_FAILURE (
144- reason || `test timed out after ${ timeout } ms` ,
144+ `test timed out after ${ timeout } ms` ,
145145 kTestTimeoutFailure ,
146146 ) ;
147147 } ) ,
@@ -181,31 +181,20 @@ class TestPlan {
181181 #timeoutId = null ;
182182
183183 constructor ( count , options = kEmptyObject ) {
184- this . #validateConstructorArgs( count , options ) ;
185- this . expected = count ;
186- this . actual = 0 ;
187- this . #setWaitOption( options ) ;
188- }
189-
190- #validateConstructorArgs( count , options ) {
191184 validateUint32 ( count , 'count' ) ;
192185 validateObject ( options , 'options' ) ;
193- }
186+ this . expected = count ;
187+ this . actual = 0 ;
194188
195- #setWaitOption( options ) {
196- switch ( typeof options . wait ) {
197- case 'boolean' :
198- this . wait = options . wait ;
199- this . #waitIndefinitely = options . wait ;
200- break ;
201- case 'number' :
202- validateNumber ( options . wait , 'options.wait' , 0 , TIMEOUT_MAX ) ;
203- this . wait = options . wait ;
204- break ;
205- default :
206- if ( options . wait !== undefined ) {
207- throw new ERR_INVALID_ARG_TYPE ( 'options.wait' , [ 'boolean' , 'number' ] , options . wait ) ;
208- }
189+ const { wait } = options ;
190+ if ( typeof wait === 'boolean' ) {
191+ this . wait = wait ;
192+ this . #waitIndefinitely = wait ;
193+ } else if ( typeof wait === 'number' ) {
194+ validateNumber ( wait , 'options.wait' , 0 , TIMEOUT_MAX ) ;
195+ this . wait = wait ;
196+ } else if ( wait !== undefined ) {
197+ throw new ERR_INVALID_ARG_TYPE ( 'options.wait' , [ 'boolean' , 'number' ] , wait ) ;
209198 }
210199 }
211200
@@ -513,8 +502,6 @@ class Test extends AsyncResource {
513502 super ( 'Test' ) ;
514503
515504 let { fn, name, parent } = options ;
516- // TODO(pmarchini): The plan has additional options that a user can set via t.plan.
517- // We should allow users to set these options via the options object for consistency.
518505 const { concurrency, entryFile, loc, only, timeout, todo, skip, signal, plan } = options ;
519506
520507 if ( typeof fn !== 'function' ) {
0 commit comments