MattB
MattB2mo 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.2mo ago
assertThrows() is for synchronous code. I think assertReject() (see https://jsr.io/@std/assert/doc/~/assertRejects) is what you're looking for.
MattB
MattBOP2mo ago
Thanks @marvinh. I'll give that a go. Looks "promising"..