faker icon indicating copy to clipboard operation
faker copied to clipboard

Random seeded tests are not random

Open ST-DDT opened this issue 3 years ago • 0 comments

Pre-Checks

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

ST-DDT avatar Aug 29 '22 15:08 ST-DDT