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 invisible characters highlighting in diffs #2673

Closed
knowbody opened this issue Jan 23, 2017 · 5 comments · Fixed by #2674
Closed

Add invisible characters highlighting in diffs #2673

knowbody opened this issue Jan 23, 2017 · 5 comments · Fixed by #2674

Comments

@knowbody
Copy link

knowbody commented Jan 23, 2017

feature request

What is the current behavior?

Currently the diffs don't check for invisible characters like spaces. I spent a bit of time debugging an invariant error check. And my tests weren't passing because I was leaving a space before the new line character. In the end I used .toThrowErrorMatchingSnapshot() and copy pasting that to my test case made the test pass and made me realise that I was adding that extra space before \n.

.toThrowError("There is no route defined for key Settings. \nMust be one of: 'Home'");

image

and passes fine when:

.toThrowError("There is no route defined for key Settings.\nMust be one of: 'Home'");

At the moment it's hard to guess, what it is, at first I thought that there was something wrong with how the quotes are being escaped, as that's what is shown in the diff.

What is the expected behavior?

It would be great if we could highlight these invisible characters in the diff.

@thymikee
Copy link
Collaborator

Since Jest 18.1.0 we're highlighting trailing whitespace: #2347
Can you update to this version and see if it works for you?

@knowbody
Copy link
Author

actually I still get the same thing:

image

image

@thymikee
Copy link
Collaborator

I've opened a PR with a fix for that

@knowbody
Copy link
Author

thank you @thymikee for fixing it!

@jfmengels jfmengels mentioned this issue Jan 23, 2017
24 tasks
@github-actions
Copy link

This issue 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.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants