@@ -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,19 @@ class MockTimers {
513526 this . #toggleEnableTimers( true ) ;
514527 }
515528
529+ /**
530+ * The `[SymbolDispose]` method is a custom method that can be used to dispose of the MockTimers instance.
531+ * It internally calls the `reset` method to reset and disable the timers.
532+ * It is intended for internal use and should not be called directly in most cases.
533+ */
516534 [ SymbolDispose ] ( ) {
517535 this . reset ( ) ;
518536 }
519537
538+ /**
539+ * Resets MockTimers, disabling any enabled timers and clearing the execution queue.
540+ * Does nothing if MockTimers are not enabled.
541+ */
520542 reset ( ) {
521543 // Ignore if not enabled
522544 if ( ! this . #isEnabled) return ;
@@ -531,6 +553,10 @@ class MockTimers {
531553 }
532554 }
533555
556+ /**
557+ * Runs all scheduled timers until there are no more pending timers.
558+ * @throws {ERR_INVALID_STATE } If MockTimers are not enabled.
559+ */
534560 runAll ( ) {
535561 if ( ! this . #isEnabled) {
536562 throw new ERR_INVALID_STATE (
0 commit comments