Skip to content
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

Merged
merged 2 commits into from
Jul 28, 2017
Merged

Conversation

ferrannp
Copy link
Contributor

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.

? contextLines
: 'null'} ${typeof contextLines !== 'number' || contextLines < 0
? '(5 default)'
: ''}`, () => {
Copy link
Collaborator

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

Copy link
Collaborator

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?

Copy link
Contributor Author

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
Copy link
Collaborator

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()

Copy link
Collaborator

@thymikee thymikee left a 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

@thymikee thymikee changed the title Be able to define custom contextLines on jest-diff Add contextLines option to jest-diff Jul 28, 2017
@cpojer cpojer merged commit 1953971 into jestjs:master Jul 28, 2017
tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
* Be able to define custom contextLines on jest-diff.

* Naming changes into diff.test.js.
@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make diff context configurable
4 participants