@@ -455,6 +455,13 @@ class MockTimers {
455455 ) ;
456456 }
457457
458+ /**
459+ * Advances the virtual time of MockTimers by the specified duration (in milliseconds).
460+ * This method simulates the passage of time and triggers any scheduled timers that are due.
461+ * @param {number } [time=1] - The amount of time (in milliseconds) to advance the virtual time.
462+ * @throws {ERR_INVALID_STATE } If MockTimers are not enabled.
463+ * @throws {ERR_INVALID_ARG_VALUE } If a negative time value is provided.
464+ */
458465 tick ( time = 1 ) {
459466 if ( ! this . #isEnabled) {
460467 throw new ERR_INVALID_STATE (
@@ -488,6 +495,12 @@ class MockTimers {
488495 }
489496 }
490497
498+ /**
499+ * Enables MockTimers for the specified timers.
500+ * @param {string[] } timers - An array of timer types to enable, e.g., ['setTimeout', 'setInterval'].
501+ * @throws {ERR_INVALID_STATE } If MockTimers are already enabled.
502+ * @throws {ERR_INVALID_ARG_VALUE } If an unsupported timer type is specified.
503+ */
491504 enable ( timers = SUPPORTED_TIMERS ) {
492505 if ( this . #isEnabled) {
493506 throw new ERR_INVALID_STATE (
@@ -513,10 +526,17 @@ class MockTimers {
513526 this . #toggleEnableTimers( true ) ;
514527 }
515528
529+ /**
530+ * An alias for `this.reset()`, allowing the disposal of the `MockTimers` instance.
531+ */
516532 [ SymbolDispose ] ( ) {
517533 this . reset ( ) ;
518534 }
519535
536+ /**
537+ * Resets MockTimers, disabling any enabled timers and clearing the execution queue.
538+ * Does nothing if MockTimers are not enabled.
539+ */
520540 reset ( ) {
521541 // Ignore if not enabled
522542 if ( ! this . #isEnabled) return ;
@@ -531,6 +551,10 @@ class MockTimers {
531551 }
532552 }
533553
554+ /**
555+ * Runs all scheduled timers until there are no more pending timers.
556+ * @throws {ERR_INVALID_STATE } If MockTimers are not enabled.
557+ */
534558 runAll ( ) {
535559 if ( ! this . #isEnabled) {
536560 throw new ERR_INVALID_STATE (
0 commit comments