Hi!
Today I was in a dire need of a fail() function to fail my tests and after looking through documentation and examples, I remembered there was this it('', (done) => {...}) thing, in a time where Promises were not yet popular :-)
I realized that done is not only a function, but also has a done.fail(), which is super valuable for cases like
try {
await fnWhichShouldFail();
done.fail();
} catch(e) {
expect(e.message).toBe('some failure');
}
For async function flows or chained promises with a catch, I didn't find a clean way to prevent undetected errors for erroneous testing code (if I hadn't had the done.fail() in the example above, a test would run through green, if fnWhichShouldFail() was mocked wrongly and doesn't throw.
So my question is: Is there any reason why there is no documentation about that? Or do you have plans for a better API replacement?
Hi!
Today I was in a dire need of a
fail()function to fail my tests and after looking through documentation and examples, I remembered there was thisit('', (done) => {...})thing, in a time where Promises were not yet popular :-)I realized that
doneis not only a function, but also has adone.fail(), which is super valuable for cases likeFor async function flows or chained promises with a
catch, I didn't find a clean way to prevent undetected errors for erroneous testing code (if I hadn't had thedone.fail()in the example above, a test would run through green, iffnWhichShouldFail()was mocked wrongly and doesn't throw.So my question is: Is there any reason why there is no documentation about that? Or do you have plans for a better API replacement?