Skip to content

Commit

Permalink
Stress 'cached' in TestNamePatternPrompt
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee committed May 4, 2017
1 parent 4ff8918 commit b253111
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/jest-cli/src/TestNamePatternPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = class TestNamePatternPrompt extends PatternPrompt {
constructor(pipe: stream$Writable | tty$WriteStream, prompt: Prompt) {
super(pipe, prompt);
this._entityName = 'tests';
this._cachedTestResults = [];
}

_onChange(pattern: string, options: ScrollOptions) {
Expand All @@ -51,7 +52,12 @@ module.exports = class TestNamePatternPrompt extends PatternPrompt {
printPatternCaret(pattern, pipe);

if (pattern) {
printPatternMatches(total, 'test', pipe, ` from cached test suites`);
printPatternMatches(
total,
'test',
pipe,
` from ${require('chalk').yellow('cached')} test suites`,
);

const width = getTerminalWidth();
const {start, end, index} = scroll(total, options);
Expand Down Expand Up @@ -96,7 +102,7 @@ module.exports = class TestNamePatternPrompt extends PatternPrompt {
return matchedTests;
}

updateCachedTestResults(testResults: Array<TestResult>) {
this._cachedTestResults = testResults || [];
updateCachedTestResults(testResults: Array<TestResult> = []) {
this._cachedTestResults = testResults;
}
};

0 comments on commit b253111

Please sign in to comment.