lukeed / uvu

uvu is an extremely fast and lightweight test runner for Node.js and the browser
MIT License
2.97k stars 100 forks source link

[question] does `uvu/assert` have something like ava's `t.plan()` #150

Closed stefanprobst closed 2 years ago

stefanprobst commented 2 years ago

hi, does uvu/assert have something similar to AVA's t.plan() or expect.assertions()? thanks!

lukeed commented 2 years ago

Hey there, no it doesn't. This is because async/await is supported out of the box and there's no need for another asynchronous controller.

You can replicate it by tracking your own counter.

test("hello", () => {
  let plan = 10;
  for (let i=0; i<10; i++) {
    assert.type(i, 'number');
    plan--;
  }
  assert.is(plan, 0, 'all 10 plans ran');
})

Hope that helps