-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jest-diff: Add changeColor and patchColor options #8911
jest-diff: Add changeColor and patchColor options #8911
Conversation
diffLinesUnified(a, b, options) const options = {
contextLines: 1,
expand: false,
patchColor: chalk.dim,
}; const identity = string => string;
const options = {
aColor: identity,
bColor: identity,
changeColor: identity,
commonColor: identity,
contextLines: 1,
expand: false,
patchColor: identity,
}; Residue 1: Residue 2: |
Codecov Report
@@ Coverage Diff @@
## master #8911 +/- ##
==========================================
+ Coverage 64.24% 64.25% +<.01%
==========================================
Files 275 275
Lines 11658 11657 -1
Branches 2846 2845 -1
==========================================
Hits 7490 7490
Misses 3544 3544
+ Partials 624 623 -1
Continue to review full report at Codecov.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Provide options for the remaining 2 hard-coded colors used by
diffStringsUnified
Residue: the default export can output 2 additional hard-coded colors in edge cases:
cyan
for lines for which indentation is the only difference: will be superseded byignoreIndentation
option and no color distinction for such common linesbgYellow
for leading or trailing spaces in common lines, because inverse of dim is invisible, but it is not clear that they need formatting@thymikee after the residue has been solved, it seems like the default
colors: false
option insnapshot-diff
package can replacestrip-ansi
with identity function forjest-diff
color optionsTest plan
Added 1 and updated 3 snapshots in
diffs.test.ts.snap
Add string serializer to omit double quote marks and use options to omit line colors:
getAlignedDiffs.test.ts.snap
joinAlignedDiffs.test.ts.snap
See also pictures in the following comments
Baseline at left and optional at right