diff --git a/packages/jest-core/src/FailedTestsInteractiveMode.ts b/packages/jest-core/src/FailedTestsInteractiveMode.ts index 3e200fdae47c..7fe7d8d681f2 100644 --- a/packages/jest-core/src/FailedTestsInteractiveMode.ts +++ b/packages/jest-core/src/FailedTestsInteractiveMode.ts @@ -37,7 +37,9 @@ export default class FailedTestsInteractiveMode { put(key: string): void { switch (key) { case 's': - if (this._skippedNum === this._testAssertions.length) break; + if (this._skippedNum === this._testAssertions.length) { + break; + } this._skippedNum += 1; // move skipped test to the end @@ -68,12 +70,12 @@ export default class FailedTestsInteractiveMode { } run( - failedSnapshotTestAssertions: Array, + failedTestAssertions: Array, updateConfig: RunnerUpdateFunction, ): void { - if (!failedSnapshotTestAssertions.length) return; + if (failedTestAssertions.length === 0) return; - this._testAssertions = [...failedSnapshotTestAssertions]; + this._testAssertions = [...failedTestAssertions]; this._countPaths = this._testAssertions.length; this._updateTestRunnerConfig = updateConfig; this._isActive = true; @@ -81,7 +83,7 @@ export default class FailedTestsInteractiveMode { } updateWithResults(results: AggregatedResult): void { - if (!results.snapshot.failure && results.numFailedTests) { + if (!results.snapshot.failure && results.numFailedTests > 0) { return this._drawUIOverlay(); } @@ -115,9 +117,9 @@ export default class FailedTestsInteractiveMode { let stats = `${pluralize('test', this._countPaths)} reviewed`; - if (this._skippedNum) { + if (this._skippedNum > 0) { const skippedText = chalk.bold.yellow( - pluralize('snapshot', this._skippedNum) + ' skipped', + pluralize('test', this._skippedNum) + ' skipped', ); stats = `${stats}, ${skippedText}`; @@ -143,9 +145,9 @@ export default class FailedTestsInteractiveMode { const numRemaining = this._countPaths - numPass - this._skippedNum; let stats = `${pluralize('test', numRemaining)} remaining`; - if (this._skippedNum) { + if (this._skippedNum > 0) { const skippedText = chalk.bold.yellow( - pluralize('snapshot', this._skippedNum) + ' skipped', + pluralize('test', this._skippedNum) + ' skipped', ); stats = `${stats}, ${skippedText}`; diff --git a/packages/jest-core/src/plugins/FailedTestsInteractive.ts b/packages/jest-core/src/plugins/FailedTestsInteractive.ts index 7759c99d8d0f..8fcb9b3f9c88 100644 --- a/packages/jest-core/src/plugins/FailedTestsInteractive.ts +++ b/packages/jest-core/src/plugins/FailedTestsInteractive.ts @@ -21,9 +21,7 @@ export default class FailedTestsInteractivePlugin extends BaseWatchPlugin { apply(hooks: JestHookSubscriber): void { hooks.onTestRunComplete(results => { - this._failedTestAssertions = this.getFailedSnapshotTestAssertions( - results, - ); + this._failedTestAssertions = this.getFailedTestAssertions(results); if (this._manager.isActive()) this._manager.updateWithResults(results); }); @@ -48,7 +46,10 @@ export default class FailedTestsInteractivePlugin extends BaseWatchPlugin { updateConfigAndRun: UpdateConfigCallback, ): Promise { return new Promise(resolve => { - if (!this._failedTestAssertions || this._failedTestAssertions.length === 0) { + if ( + !this._failedTestAssertions || + this._failedTestAssertions.length === 0 + ) { resolve(); return; } @@ -67,7 +68,7 @@ export default class FailedTestsInteractivePlugin extends BaseWatchPlugin { }); } - private getFailedSnapshotTestAssertions( + private getFailedTestAssertions( results: AggregatedResult, ): Array { const failedTestPaths: Array = [];