jest-watch-typeahead
Advanced tools
Comparing version 0.2.2-0 to 0.2.2-1
@@ -128,20 +128,21 @@ "use strict"; | ||
const endPatternIndex = startPatternIndex + match[0].length; | ||
const testNameFitsInTerminal = inlineTestName.length <= width; | ||
if (inlineTestName.length <= width) { | ||
if (testNameFitsInTerminal) { | ||
return colorize(inlineTestName, startPatternIndex, endPatternIndex); | ||
} | ||
const slicedTestName = inlineTestName.slice(0, width - DOTS.length); | ||
const numberOfTruncatedChars = DOTS.length + inlineTestName.length - width; | ||
const end = Math.max(endPatternIndex - numberOfTruncatedChars, 0); | ||
const truncatedTestName = inlineTestName.slice(numberOfTruncatedChars); | ||
const shouldHighlightDots = startPatternIndex <= numberOfTruncatedChars; | ||
if (startPatternIndex < slicedTestName.length) { | ||
if (endPatternIndex > slicedTestName.length) { | ||
return colorize(slicedTestName + DOTS, startPatternIndex, slicedTestName.length + DOTS.length); | ||
} | ||
return colorize(slicedTestName + DOTS, Math.min(startPatternIndex, slicedTestName.length), endPatternIndex); | ||
if (shouldHighlightDots) { | ||
return colorize(DOTS + truncatedTestName, 0, end + DOTS.length); | ||
} | ||
return `${_chalk.default.dim(slicedTestName)}${_chalk.default.reset(DOTS)}`; | ||
const start = startPatternIndex - numberOfTruncatedChars; | ||
return colorize(DOTS + truncatedTestName, start + DOTS.length, end + DOTS.length); | ||
}; | ||
exports.formatTestNameByPattern = formatTestNameByPattern; |
@@ -6,2 +6,3 @@ ## master | ||
- Bump dated dependencies ([#25](https://github.com/jest-community/jest-watch-typeahead/pull/25)) | ||
- Get better truncation for testname typeahead by truncating the start and not the end ([#28](https://github.com/jest-community/jest-watch-typeahead/pull/28)) | ||
@@ -8,0 +9,0 @@ ### Fixes |
{ | ||
"name": "jest-watch-typeahead", | ||
"version": "0.2.2-0", | ||
"version": "0.2.2-1", | ||
"main": "build/index.js", | ||
@@ -5,0 +5,0 @@ "author": "Rogelio Guzman <rogelioguzmanh@gmail.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23182
461