77
88import type { Config } from '@jest/types' ;
99import type { AggregatedResult , AssertionLocation } from '@jest/test-result' ;
10- import { BaseWatchPlugin , JestHookSubscriber } from 'jest-watcher' ;
10+ import { BaseWatchPlugin , JestHookSubscriber , UsageData } from 'jest-watcher' ;
1111import SnapshotInteractiveMode from '../SnapshotInteractiveMode' ;
1212
1313class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
@@ -41,7 +41,7 @@ class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
4141 return failedTestPaths ;
4242 }
4343
44- apply ( hooks : JestHookSubscriber ) {
44+ apply ( hooks : JestHookSubscriber ) : void {
4545 hooks . onTestRunComplete ( results => {
4646 this . _failedSnapshotTestAssertions = this . getFailedSnapshotTestAssertions (
4747 results ,
@@ -52,7 +52,7 @@ class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
5252 } ) ;
5353 }
5454
55- onKey ( key : string ) {
55+ onKey ( key : string ) : void {
5656 if ( this . _snapshotInteractiveMode . isActive ( ) ) {
5757 this . _snapshotInteractiveMode . put ( key ) ;
5858 }
@@ -85,11 +85,8 @@ class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
8585 }
8686 }
8787
88- getUsageInfo ( ) {
89- if (
90- this . _failedSnapshotTestAssertions &&
91- this . _failedSnapshotTestAssertions . length > 0
92- ) {
88+ getUsageInfo ( ) : UsageData | null {
89+ if ( this . _failedSnapshotTestAssertions ?. length > 0 ) {
9390 return {
9491 key : 'i' ,
9592 prompt : 'update failing snapshots interactively' ,
0 commit comments