Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jest expect async function to throw error

it('should test async errors', async () =>  {        
    await expect(failingAsyncTest())
    .rejects
    .toThrow('I should fail');
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jest #expect #async #function #throw #error
ADD COMMENT
Topic
Name
4+6 =