How to run a (flaky) test multiple times using Jest

When you discover that your test is flaky - it might be a good idea to run it multiple times to further validate that what you've done to fix actually (maybe) fixes it.

Using Jest it's pretty easy.

You can replace

test("it was flaky", () => {})

with:

test.each(
  Array(100).fill()
)("hopefully it's not flaky anymore", () => {})

Till the next one!