mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
b338b541ac
The implementation for `assert.throws()` from `node:assert` didn't work when the expected value was an `Error` constructor. In this case the thrown error should checked if it's an instance of said constructor. Fixes https://github.com/denoland/deno/issues/24464
18 lines
363 B
TypeScript
18 lines
363 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
import * as assert from "node:assert";
|
|
|
|
Deno.test("[node/assert] .throws() compares Error instance", () => {
|
|
assert.throws(
|
|
() => {
|
|
throw new Error("FAIL");
|
|
},
|
|
Error,
|
|
);
|
|
|
|
assert.throws(
|
|
() => {
|
|
throw new TypeError("FAIL");
|
|
},
|
|
TypeError,
|
|
);
|
|
});
|