Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node/assert): throws not checking error instance #24466

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

marvinhagemeister
Copy link
Contributor

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 #24464

import * as assert from "node:assert";

Deno.test("[node/assert] .throws() compares Error instance", () => {
assert.throws(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just calling it like this would throw an error previously, see the linked issue.

Copy link
Member

@satyarohith satyarohith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@marvinhagemeister marvinhagemeister merged commit b338b54 into main Jul 8, 2024
17 checks passed
@marvinhagemeister marvinhagemeister deleted the node-assert-throws branch July 8, 2024 19:28
zebreus pushed a commit to zebreus/deno that referenced this pull request Jul 8, 2024
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 denoland#24464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: assert.throws() cannot compare error class
3 participants