Seed the random generator and print the seed on failure
A test that uses random data and fails cannot be reproduced unless you know the seed.
const seed = Number(process.env.TEST_SEED ?? Date.now());
console.log(`seed: ${seed}`);
const rng = seedrandom(String(seed));The failing run's log has the seed. Set TEST_SEED and the same inputs come back, on your laptop, until it is fixed.
testing