File tree Expand file tree Collapse file tree 2 files changed +12
-18
lines changed Expand file tree Collapse file tree 2 files changed +12
-18
lines changed Original file line number Diff line number Diff line change @@ -45,3 +45,5 @@ You cannot use `t.teardown()` in hooks either.
45
45
## ` t.timeout(ms) `
46
46
47
47
Set a timeout for the test, in milliseconds. The test will fail if this timeout is exceeded. The timeout is reset each time an assertion is made.
48
+
49
+ Use ` t.timeout(0) ` to restore the default behavior.
Original file line number Diff line number Diff line change @@ -289,7 +289,6 @@ export default class Test {
289
289
this . pendingAttemptCount = 0 ;
290
290
this . planCount = null ;
291
291
this . startedAt = 0 ;
292
- this . timeoutMs = 0 ;
293
292
this . timeoutTimer = null ;
294
293
}
295
294
@@ -418,28 +417,21 @@ export default class Test {
418
417
}
419
418
420
419
this . clearTimeout ( ) ;
421
- this . timeoutMs = ms ;
422
- this . timeoutTimer = nowAndTimers . setCappedTimeout ( ( ) => {
423
- this . saveFirstError ( new Error ( message || 'Test timeout exceeded' ) ) ;
420
+ if ( ms !== 0 ) {
421
+ this . timeoutTimer = nowAndTimers . setCappedTimeout ( ( ) => {
422
+ this . saveFirstError ( new Error ( message || 'Test timeout exceeded' ) ) ;
424
423
425
- if ( this . finishDueToTimeout ) {
426
- this . finishDueToTimeout ( ) ;
427
- }
428
- } , ms ) ;
424
+ if ( this . finishDueToTimeout ) {
425
+ this . finishDueToTimeout ( ) ;
426
+ }
427
+ } , ms ) ;
428
+ }
429
429
430
- this . notifyTimeoutUpdate ( this . timeoutMs ) ;
430
+ this . notifyTimeoutUpdate ( ms ) ;
431
431
}
432
432
433
433
refreshTimeout ( ) {
434
- if ( ! this . timeoutTimer ) {
435
- return ;
436
- }
437
-
438
- if ( this . timeoutTimer . refresh ) {
439
- this . timeoutTimer . refresh ( ) ;
440
- } else {
441
- this . timeout ( this . timeoutMs ) ;
442
- }
434
+ this . timeoutTimer ?. refresh ( ) ;
443
435
}
444
436
445
437
clearTimeout ( ) {
You can’t perform that action at this time.
0 commit comments