-
-
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
Add contextLines
option to jest-diff
#4152
Conversation
? contextLines | ||
: 'null'} ${typeof contextLines !== 'number' || contextLines < 0 | ||
? '(5 default)' | ||
: ''}`, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need to run prettier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, this is OK. But maybe we can make it more readable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flow complains if I extract it and I did not simplify it because 0 is falsy too.
_test(2); | ||
_test(1); | ||
_test(0); | ||
_test(-1); // Will use default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this function? E.g. testDiffContextLines()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍. Left some comments inlined
contextLines
option to jest-diff
* Be able to define custom contextLines on jest-diff. * Naming changes into diff.test.js.
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
Fixes #4147. This will be useful for libraries like https://github.com/thymikee/snapshot-diff.
Test plan
Added several test cases (with snapshots) in
diff.test.js
.