MattB
MattB5mo ago

assertThrows with async function

I'm using assertThrows with an async function and it doesn't seem to work no matter what I try. Any clues? The error is always thrown, but the test still fails.
No description
2 Replies
marvinh.
marvinh.5mo ago
assertThrows() is for synchronous code. I think assertReject() (see https://jsr.io/@std/assert/doc/~/assertRejects) is what you're looking for.
MattB
MattBOP5mo ago
Thanks @marvinh. I'll give that a go. Looks "promising"..

Did you find this page helpful?