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

fix(jest-jasmine2): point to inline snapshot documentation if prettier is unavailable #7744

Closed

Conversation

theneva
Copy link
Contributor

@theneva theneva commented Jan 29, 2019

Summary

Use of inline snapshots requires the project to expose prettier. If prettier is not available, Jest currently fails with a message that does not indicate any required action on the user's part:

image

These changes append a brief message and a link to the inline snapshot docs to that message (I've since changed prettier to Prettier in the message):

image

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:

  1. Linked jest-jasmine2 into the test project
  2. Made my changes to jest
  3. Built jest
  4. rm -rf node_modules/prettier in jest to prevent it being accidentally made available through the linked dependency
  5. Ran yarn jest in the test project

If 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 😄

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.

Thanks!

Mind adding a test? Integration test is fine (if it's possible to make the module not possible to find).

This also needs to update for jest-circus

@SimenB
Copy link
Member

SimenB commented May 15, 2019

@theneva mind rebasing this and fixing it for circus as well? As for a test, I think the easiest might be to do prettierPath: 'some-module-that-does-not-exist' in an integration test

@SimenB
Copy link
Member

SimenB commented Nov 9, 2019

@theneva ping, pls rebase this

@thymikee
Copy link
Collaborator

thymikee commented May 3, 2020

Closing, since this will soon be fixed by #7792. Thanks!

@thymikee thymikee closed this May 3, 2020
@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 11, 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.

4 participants