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

Snapshots Can Have Weird Characters In Them #1715

Closed
rzec-r7 opened this issue Feb 16, 2018 · 3 comments
Closed

Snapshots Can Have Weird Characters In Them #1715

rzec-r7 opened this issue Feb 16, 2018 · 3 comments

Comments

@rzec-r7
Copy link

rzec-r7 commented Feb 16, 2018

Description

Snapshot seems to sometimes have weird characters at the end of lines in the generated .md file. There have been some cases where with a component, it would render a unicode star.

The one use-case the is simple to reproduce and always happens is using a snap show to compare a simple sting. I want to use a snapshot because the string is dynamically generated and can be quite large and write those test is any other way would just take too much time and would be very brittle. The issue with snapshotting string if that the line return character are being literally printed out:

## test

> Snapshot 1

    `just want␊
    to test␍␊
    something`

Test Source

test('test, (t) => {
  t.snapshot('just want\nto test\r\nsomething');
});

Environment

Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly:

OS: Mac OS X 10.13.3
node: 8.9.4
ava: 0.25.0
npm: 5.6.0
@novemberborn
Copy link
Member

This is intentional. We want to show these otherwise invisible characters. In fact we'd like to show more.

Do you find this behavior surprising? Did you think it impacts the test outcome?

(I'm closing this issue for housekeeping purposes, but let's keep the conversation going.)

@rzec-r7
Copy link
Author

rzec-r7 commented Feb 16, 2018

I found it a bit surprising (at least for the weird star that I have no idea why it is there, the line feed one at least makes sense on why it would be there).

As for effecting the test, no, it does not really impact it all that much (it is seems weird as I usually don't see those characters), just wanted to point this out as I was not sure if it was expected or not. Since it is intentional, I am good with it.

@novemberborn
Copy link
Member

By "weird star" do you mean ? I agree it's a bit obscure — I think it's only used with React elements. The intent is to show the difference between built-in types (they end up being strings) and function types that could have the same name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants