async function flushAllTimersAndMicrotasks(ms = 1000) {
  for (let i = 0; i < ms; i++) {
    timers.advanceTimersByTime(1);
    await Promise.resolve();
  }
}
In some functions we have lots of promise follow ups that get queued by protocol messages.
This is a convenience method to easily advance all timers and flush all the queued microtasks.