waitFor

tcmts.cli.test.e2e.watch.waitFor · #omicp7p2 · term · runs anywhere

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

used by