Skip to content

Ensure expect(function).toThrow() #1329

@rentalhost

Description

@rentalhost

When is possible to determine if the expect(value) is not a function when used with .toThrow(), it must be an error.

const str = "any value";

expect(str).toThrow() // Not works.
const returnStr = () => "any value";

expect(returnStr).toThrow() // Not handle, but is a valid case (if returnStr() throws an exception).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions