1

I am doing this:

expect(async () => {await doSomething()}).toThrow('myThrownErrorMessage');

but this throws an error in the terminal:

(node:12725) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 575): Error: myThrownErrorMessage

Is this simply a case of node capturing the error before Jest does?

JoeTidee
  • 24,754
  • 25
  • 104
  • 149
  • 1
    This should answer your question: https://stackoverflow.com/questions/47144187/can-you-write-async-tests-that-expect-tothrow – Darlesson Feb 07 '19 at 18:45

0 Answers0