Skip to content

t.throws() with regex not working as expected #1445

@stevenvachon

Description

@stevenvachon

This fails:

t.throws(() => { throw new TypeError("Invalid URL: http://") }, /^Invalid URL/)

... yet:

/^Invalid URL/.test("Invalid URL: http://")
//-> true

error can be an error constructor, error message, regex matched against the error message, or validation function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions