Skip to main content

@rbxts/expect > Assertion > throwsMatch

Assertion.throwsMatch() method

Asserts that the function throws an exception that matches the lua pattern pattern.

Signature:

throwsMatch(pattern: string): Assertion<T>;

Parameters

Parameter

Type

Description

pattern

string

Returns:

Assertion<T>

Remarks

For string literals or substring matching, use instead.

Type alias for the throwMatch version of this.

Example

expect(buyPet).to.be.a.function().that.throwsMatch("^Error:.+Money");