Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jest always pass async await

  test.only("should not pass", async (done) => {
    try {
      const a = await getAsync()
      expect(a).toEqual(2)
      done()
    } catch (e) {
      // have to manually handle the failed test with "done.fail"
      done.fail(e)
    }
  })
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jest #pass #async #await
ADD COMMENT
Topic
Name
5+3 =