-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
No way to get stable snapshot names with test.concurrent #5801
Comments
Duplicate of #2180 |
@SimenB sorry, but I don't see how this is a duplicate of #2180. That issue ends with someone saying:
But this issue is about the fact that it's not possible to use even named snapshots with concurrent tests. This used to work right up to 22.0.0 release when #4460 was merged. Before that change named snapshots didn't depend on currently executing test, thus they worked with If I update my repro app linked above to use jest 21.2.1 then it works, as snapshot names use only the name provided in the method call, with 22.0.0 they are prepended by the currently running tests, which is not deterministic with concurrent tests. |
#2180 is open, so it hasn't "ended". If you wanna see it happen, please send a PR 🙂 |
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. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Trying to use named snapshots within
it.concurrent(...)
to get stable snapshot names, but looks liketoMatchSnapshot
still tries to reference current test name as well, which is not deterministic with concurrent tests.This seems to have been changed in #4460, before that named snapshots would've worked with concurrent tests.
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can
yarn install
andyarn test
.Example repo showing the issue is here:
https://github.com/poolik/jest-named-snapshots-bug
Just look at the src/tests/concurrent.ts. There are several async concurrent tests there using random time to compute and writing their results to named snapshots. The issue is that snapshots names are not deterministic, but depend on currently executing test name, which is random in concurrent tests.
What is the expected behavior?
I should be able to use named snapshots in concurrent tests in a deterministic way (provided that the snapshot names are unique across test suite).
Please provide your exact Jest configuration
View the repro application @ https://github.com/poolik/jest-named-snapshots-bug
Run
npx envinfo --preset jest
in your project directory and paste theresults here
The text was updated successfully, but these errors were encountered: