faker
faker copied to clipboard
Random seeded tests are not random
Pre-Checks
- [X] Follow our Code of Conduct.
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Faker issue and not related to a combination with another package.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
- [X] I am willing to provide a PR.
Describe the bug
The random seeded tests are not random.
Minimal reproduction code
describe('test', () => {
describe('a', () => {
console.log('a0');
it('test-a', () => {
console.log('a1');
expect(true).toBe(true);
});
});
describe(`random seeded tests for seed ${faker.seed()}`, () => {
console.log('b0');
it('test-b()', () => {
console.log('b1');
expect(true).toBe(true);
});
});
});
Output:
stdout | unknown test
a0
b0
stdout | test/word.spec.ts > test > a > test-a
a1
stdout | test/word.spec.ts > test > random seeded tests for seed 2458092977221118 > test-b()
b1
If we replace a0 with the fixed seeded tests and b0 with the random seeded tests, then we have our current setup.
The test sources currently assume that the test blocks will be run in the following order: a0, a1, b0, b0.
Additional Context
No response
Environment Info
TLDR: irrelevant information and the command outputs also wrong information
System:
OS: Windows 10 (wrong)
CPU: irrelevant
Memory: irrelevant
Binaries:
Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
npm: 8.16.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: wrong and unused
Internet Explorer: I didn't know where this might be installed
----------
The above info are partially wrong as I used win11 when running the command.
Also the browser list is wrong.
Not sure where the command got these versions.
Which module system do you use?
- [ ] CJS
- [ ] ESM
Used Package Manager
pnpm