-
-
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
feat: add a seed value to test runs #13400
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exciting stuff! left some quick comments on direction, haven't done a thorough review (currently on vacation, so a bit on and off)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fantastic work, thanks!
@mrazauskas any other comments? If not, I'll merge 🙂 |
Thanks! Looks like all is done. |
@@ -1614,6 +1614,12 @@ const config: Config = { | |||
export default config; | |||
``` | |||
|
|||
### `showSeed` \[boolean] | |||
|
|||
Default: `false` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such a great option, I love it 💕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just about to tag you 🙂 Does this (i.e. this entire implementation, not just this specific option) fit your use case and usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking you can just document setting this config flag instead of printing the seed yourself (as a major release I guess)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will definitely help a lot. So far @fast-check/jest
was mostly responsible for building a seed for fast-check
and appending it to the name of the it
(and also provide a it
tailored for pbt). With both seed
and showSeed
options altering the name of the test might not be that required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't documented the removal of the seed printing yet, but that was my idea when I opened dubzzz/fast-check#3287
Jest 29.2 added an option to set a seed, which fast-check uses, and to show it. In the event of a failure, we can rerun the tests with the same seed, making debugging non-deterministic failures far simpler. I'm not sure why Dependabot isn't updating Jest/ts-jest to v29. Refs #388, a6b0f11, jestjs/jest#13400, dubzzz/fast-check#3332
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. |
Summary
Context from this conversation.
jest will now generate a
seed
value when running via the CLI. Thisseed
can be accessed in the runtime viajest.getSeed()
.You can also manually specify the seed with
--seed=1234
.Test plan
Screen.Recording.2022-10-07.at.21.58.14.mov