waitFor

tcmts.cli.test.e2e.web.waitFor · #rm5jgniy · term · runs anywhere

export const waitFor = async (cond: () => boolean, ms = 8000) => {
  for (const end = Date.now() + ms; Date.now() < end; await new Promise((r) => setTimeout(r, 100))) if (cond()) return;
  throw new Error("timed out waiting");
}

used by