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

feat: Better print for sparse arrays #11326

Merged
merged 5 commits into from Apr 22, 2021
Merged

Conversation

dubzzz
Copy link
Contributor

@dubzzz dubzzz commented Apr 21, 2021

Summary

With current version of Jest, sparse arrays are handled as any other arrays when printing them. The resulting string replaces holes by undefined. This PR replaces the way sparse arrays are printed to show holes as holes while keeping undefined values as undefined values.

Test plan

Tests have been added to check the new behaviour.

@dubzzz dubzzz changed the title Better print for sparse arrays feat: Better print for sparse arrays Apr 21, 2021
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Could you add a changelog entry as well? 🙂

@SimenB SimenB merged commit 7028265 into jestjs:master Apr 22, 2021
@SimenB
Copy link
Member

SimenB commented Apr 22, 2021

Hmm, I guess this is a breaking change for people snapshotting sparse arrays... Next release is major, so no issue there, but possibly it should be marked as breaking in the changelog?

@dubzzz
Copy link
Contributor Author

dubzzz commented Apr 22, 2021

Hmm, I guess this is a breaking change for people snapshotting sparse arrays... Next release is major, so no issue there, but possibly it should be marked as breaking in the changelog?

Definitely a possible breaking.

@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 23, 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.

None yet

3 participants