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

Adds options for configuring the snapshot and inline snapshot serializers #11654

Merged
merged 16 commits into from Aug 23, 2021

Conversation

orta
Copy link
Member

@orta orta commented Jul 10, 2021

Summary

Screen Shot 2021-07-10 at 6 06 07 PM

Fixes #10730 - adds two new config options:

  • "inlineSnapshotFormatter"
  • "snapshotFormatter"

They override PrettyFormat options.

Fixes #5660

Test Plan

yarn jest should cover it, I added an e2e test but there's probably other ways to add (open to recommendations)

Tests will fail: I didn't include all the snapshot test updates so we can bikeshed these all first.

…sicPrototype option to show literals as literals
@orta orta force-pushed the add_option_inline_serializer branch from e3e3507 to d876255 Compare July 10, 2021 17:25
@orta
Copy link
Member Author

orta commented Jul 12, 2021

OK, I've switched this out to have both:

  • inlineSnapshotFormat
  • snapshotFormat

As options, which expose the full set of possible options for the formatter. So, folks can also customize the color scheme too.

If this feel reasonable, I can add all the snapshot fails and docs for it 👍🏻

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.

I think this is a sound idea 👍

@orta orta force-pushed the add_option_inline_serializer branch from cd6cbb8 to 8395cdf Compare July 12, 2021 11:12
@orta orta changed the title Adds an option for having inline snapshot serializers use the printBasicPrototype option to show literals as literals Adds options for having configuring the snapshot and inline snapshot serializers Jul 12, 2021
@orta orta force-pushed the add_option_inline_serializer branch from cd76e67 to 32f2ca2 Compare July 12, 2021 13:55
@SimenB
Copy link
Member

SimenB commented Jul 13, 2021

This solves #5660, right?

@orta
Copy link
Member Author

orta commented Jul 13, 2021

Yes

@orta orta changed the title Adds options for having configuring the snapshot and inline snapshot serializers Adds options for configuring the snapshot and inline snapshot serializers Jul 13, 2021
@Haroenv
Copy link
Contributor

Haroenv commented Jul 23, 2021

Is there anything missing in this PR we can help with? I'd love to enable these options!

docs/Configuration.md Outdated Show resolved Hide resolved
docs/Configuration.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #11654 (f63e170) into master (43a8ada) will decrease coverage by 0.01%.
The diff coverage is 46.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11654      +/-   ##
==========================================
- Coverage   69.00%   68.99%   -0.02%     
==========================================
  Files         312      312              
  Lines       16339    16348       +9     
  Branches     4736     4743       +7     
==========================================
+ Hits        11275    11279       +4     
- Misses       5036     5041       +5     
  Partials       28       28              
Impacted Files Coverage Δ
...us/src/legacy-code-todo-rewrite/jestAdapterInit.ts 0.00% <ø> (ø)
packages/jest-config/src/ValidConfig.ts 100.00% <ø> (ø)
packages/jest-config/src/index.ts 18.98% <ø> (ø)
packages/jest-jasmine2/src/setup_jest_globals.ts 0.00% <0.00%> (ø)
packages/jest-snapshot/src/State.ts 0.00% <0.00%> (ø)
packages/test-utils/src/config.ts 0.00% <ø> (ø)
packages/jest-config/src/normalize.ts 89.13% <100.00%> (+0.04%) ⬆️
packages/jest-snapshot/src/utils.ts 99.00% <100.00%> (+0.01%) ⬆️
packages/pretty-format/src/index.ts 97.43% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 43a8ada...f63e170. Read the comment docs.

@orta
Copy link
Member Author

orta commented Aug 14, 2021

Yeah, TBH, I don't see significant value in having two different options - I don't have time this weekend but could add that next week

@orta
Copy link
Member Author

orta commented Aug 21, 2021

Alright, that's them consolidated I think 👍🏻

@orta orta force-pushed the add_option_inline_serializer branch from 9890f3f to 90c2a37 Compare August 22, 2021 12:44
@SimenB SimenB merged commit a22ed65 into jestjs:master Aug 23, 2021
Haroenv added a commit to algolia/instantsearch that referenced this pull request Aug 23, 2021
splincode pushed a commit to splincode/jest that referenced this pull request Aug 24, 2021
@SimenB
Copy link
Member

SimenB commented Aug 27, 2021

https://github.com/facebook/jest/releases/tag/v27.1.0

@orta
Copy link
Member Author

orta commented Aug 27, 2021

woooo

Haroenv added a commit to algolia/instantsearch that referenced this pull request Aug 31, 2021
* test(jest): opt-in to shorter snapshot format

jestjs/jest#11654

...waiting for the release of jest

* remove usage of setImmediate (doesn't exist in browser)

* make sessionStorage mock writable

* update jest to latest

* final update & snapshot changes

* simplify lockfile

* Update src/lib/__tests__/InstantSearch-test.tsx

* simpler without fake timerz
@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 Sep 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants