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

[Docs]: describe usage of the seed option within jest, mention test ordering #15060

Open
jzaefferer opened this issue May 8, 2024 · 2 comments

Comments

@jzaefferer
Copy link

Page(s)

https://jestjs.io/docs/cli#--seednum

Description

https://jestjs.io/docs/cli#--seednum describes the CLI seed option, but only mentions it's usage within getSeed (with a link to https://jestjs.io/docs/jest-object#jestgetseed ).

As far as I can tell, the seed option is also used to initialze the shuffle that applies to children of a describe block here:

if (rng) {
describeBlock.children = shuffleArray(describeBlock.children, rng);
}

If that is correct, it would help a lot to mention that test flakyness might be related to this shuffling, and reusing the same seed of a failed run can help reproduce that failure.

@SimenB
Copy link
Member

SimenB commented May 12, 2024

Good point! Wanna send a PR with this addition?

@jzaefferer
Copy link
Author

jzaefferer commented May 13, 2024

Yeah, I would do that, though I still need some clarification. I've only now noticed the randomize option: https://jestjs.io/docs/cli#--randomize Which does mention seed, too.

Since randomize is an option, does it mean this shuffling is disabled by default?

If so, should a random seed (not setting it explicitly) make any difference if randomize isn't used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants