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

[Feature] Include obsolete snapshots info in json output #2044

Closed
stefanfisk opened this issue Nov 2, 2016 · 9 comments
Closed

[Feature] Include obsolete snapshots info in json output #2044

stefanfisk opened this issue Nov 2, 2016 · 9 comments

Comments

@stefanfisk
Copy link

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
If one wants to check if there are any obsolete snapshots, one must parse the human readable command output.

What is the expected behavior?
I reckon the info should be included in the --json output.

Also it might make sense if there was a switch that made the existence of obsolete snapshots cause jest to exit with an error. The use case I personally see is having a git hook to prevent me from accidentally committing obsolete snapshots.

@khankuan
Copy link

Hmm, I'm also having trouble with obsolete. I see 1 obsolete snapshot found in the snapshot summary but it does not say which file or snapshot is causing that.

@cpojer
Copy link
Member

cpojer commented Nov 10, 2016

I was hoping we could change Jest so that it actually fails the test itself when something is obsolete.

@develar
Copy link
Contributor

develar commented Jan 14, 2017

Yeah, no way to understand what's wrong (example — https://circleci.com/gh/electron-userland/electron-builder/447?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)

It seems Jest doesn't detect that actually test is just skipped/ignored.

@cpojer
Copy link
Member

cpojer commented Jan 15, 2017

@develar do you think you could help with a PR? This data could be added here: https://github.com/cpojer/jest/blob/e4220e6659abdc4d6d4500455eb4982d3230dba3/packages/jest-jasmine2/src/index.js#L97

and we could add the testExecError to make it print the proper error.

@dan-codes-16
Copy link

Having the same issue with our project build on Jenkins, though on local dev env everything is ok.
All tests are passed, there are skipped tests, but still getting › 1 obsolete snapshot file found, run with `npm run jest -- -u` to remove it. error.

@tommytusj
Copy link

this error is really annyoing

@johndaley-me
Copy link

@adaniliuk I saw this error today but in my case it was because my build process was copying the .snap file from my src directory to my lib directory so there was in fact an extra .snap file in the entire project during the CI build. I fixed my build to not copy the .snap file and build is green again.

@thymikee
Copy link
Collaborator

Obsolete snapshots are reproted as "unchecked" in JSON output. Also, the snapshot summary was recently overhauled by @rickhanlonii #6181, will be available in Jest 23 :)

@github-actions
Copy link

This issue 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 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants