Skip to content

Ensure expect(function).toThrow() #1329

Open
@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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions