[[@std.assert (Deno)|@std/asset]]の関数。同期関数を第1引数にとり、エラーがthrowされることを期待する。第2引数にエラークラスを指定した場合は、第3引数でエラーメッセージの部分一致アサーションも可能。
```js
import { assertThrows } from "@std/assert";
function throwError() {
throw new Error("sync error");
}
Deno.test("throwError - 期待通りのメッセージを含むエラーを返す", () => {
assertThrows(throwError, Error, "error");
});
Deno.test("throwError 期待通りのメッセージを含まないエラーを返す", () => {
assertThrows(throwError, Error, "foo");
});
```