-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
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 like toMatchSnapshot
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
and yarn 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 the
results here
npx: installed 1 in 2.343s
System:
OS: macOS High Sierra 10.13.3
CPU: x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
Binaries:
Node: 8.9.4
Yarn: 1.5.1
npm: 5.6.0
npmPackages:
jest:
wanted: ^22.4.2
installed: 22.4.2