Skip to main content

@rbxts/expect > ExpectMessageBuilder > appendPrefix

ExpectMessageBuilder.appendPrefix() method

Adds a string to the end of the existing prefix.

Signature:

appendPrefix(str: string): this;

Parameters

Parameter

Type

Description

str

string

The string to add to the end of the prefix.

Returns:

this

This instance, for chaining.

Remarks

This includes the negation prefix (if any).

Example

new ExpectMessageBuilder(
`Expected ${place.name} to ${place.not} equal ${place.expected.value}`
).appendPrefix(", but it was not.");

// Would be the same as
new ExpectMessageBuilder(
`Expected ${place.name} to ${place.not} equal ${place.expected.value},
but it was not.`
);