fix(jest-jasmine2): point to inline snapshot documentation if prettier is unavailable #7744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Use of inline snapshots requires the project to expose
prettier
. Ifprettier
is not available, Jest currently fails with a message that does not indicate any required action on the user's part:These changes append a brief message and a link to the inline snapshot docs to that message (I've since changed
prettier
toPrettier
in the message):Test plan
To be honest, I have no idea how to write a test for this. To verify the changes manually, I ended up removing the
prettier
dependency from a test project (https://github.com/theneva/post-utils), and:jest-jasmine2
into the test projectjest
jest
rm -rf node_modules/prettier
injest
to prevent it being accidentally made available through the linked dependencyyarn jest
in the test projectIf it makes sense to write an integration test for this, I'd be happy to do so if someone points me in the right direction 😄