September 2018
Intermediate to advanced
764 pages
20h 6m
English
However, another limitation of Mocha is that you cannot return a rejected promise inside the hook functions. If you do, Mocha will think the test has failed. In those cases, you should move the function that you expect to fail inside the it block, and make any assertions inside a catch block:
it('should fail', function() { createUser(...) .catch(actualError => assert(actualError, expectedError))});
Read now
Unlock full access