Skip to main content

@rbxts/expect > Assertion > throwMatch

Assertion.throwMatch() method

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

Signature:

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

Parameters

Parameter

Type

Description

pattern

string

Returns:

Assertion<T>

Remarks

For string literals or substring matching, use instead.

Example

expect(buyPet).to.throwMatch("^Error:.+Money");