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 codelense action for update snapshot #4

Merged
merged 3 commits into from
Mar 18, 2020

Conversation

tinganho
Copy link
Contributor

@tinganho tinganho commented Mar 16, 2020

I added a code lense action for an update snapshot action. It just adds the command line flag -u when pressed.

@tinganho
Copy link
Contributor Author

I skipped adding the equivalent actions on explorer and editor. Since they require icons to finish. I guess you can easily add those.

@nithinpeter
Copy link
Owner

Hey 👋 Thanks for the PR.

We will show the new code lens action for all tests? Can we make it to appear only for tests which has snapshot assertions?

I think not many people will have snapshot tests and we might end up polluting their UI by adding an action for all.

We can probably look at the test and see if it has “toMatchSnapshot” string in it (or something similar)? If that’s hard to do, add a config option to show/hide (hidden by default) the code lens action.

What do you think?

@tinganho
Copy link
Contributor Author

tinganho commented Mar 17, 2020

Yeah, I think it sounds good to filter the code lense based on whether it is needed or not. Though, I think we need to add a config to match based on custom snapshot matchers as well. My use case, is not the built-in toMatchSnapshot, but toMatchImageSnapshot from jest-image-snapshot.

https://jestjs.io/docs/en/expect#custom-snapshot-matchers

@tinganho
Copy link
Contributor Author

Ok, I updated the PR to reflect my above comment. It doesn't work for it.each yet. There is a bug in jest-editor-support.

@tinganho
Copy link
Contributor Author

Logged a ticket in jest-editor-support jest-community/jest-editor-support#37

@nithinpeter nithinpeter merged commit c4b87c2 into nithinpeter:master Mar 18, 2020
@nithinpeter
Copy link
Owner

Very nice! Thanks, I will release a version with these changes soon.

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

Successfully merging this pull request may close these issues.

2 participants