lorenzofox3 / zora

Lightest, yet Fastest Javascript test runner for nodejs and browsers
MIT License
539 stars 93 forks source link

Add expectAssertions option to test #103

Closed bompus closed 3 years ago

bompus commented 3 years ago

fixes #102

bompus commented 3 years ago

I wasn't sure what to actually name the option, and I'd actually prefer to be able to call t.expectAssertions(2) instead, but that seemed hackish and more complex to implement.

lorenzofox3 commented 3 years ago

I wasn't sure what to actually name the option, and I'd actually prefer to be able to call t.expectAssertions(2) instead, but that seemed hackish and more complex to implement.

if you pass it to the assertion object then t.plan() is the convention I think. If you consider it is a "meta" option of the test and pass it as an option like you did, I would rather call it something like exepectedAssertionCount so the idea of "count" can be read.

Semantically it is a bit in between: yes it is a kind of meta option of the test and yes it can be seen as an assertion on the test. Although you can't model the latter with a regular pure function as you do for the other assertions.

bompus commented 3 years ago

Upon discussion in #102 , I no longer believe this is necessary. If it comes up again, this will be a good starting poing for implementing the logic though.