@rbxts/expect > ExpectMessageBuilder > trailingFailureSuffix
ExpectMessageBuilder.trailingFailureSuffix() method
Adds a string to show at the end of the message, before the metadata.
Only applies if the message is a failure.
Signature:
trailingFailureSuffix(str?: string): this;
Parameters
Parameter | Type | Description |
---|---|---|
str | string | (Optional) The string to add after the message. |
Returns:
this
This instance, for chaining.
Remarks
Comes after the suffix (if any).
Note that there can only be one, calling this method again will replace the previous value- not append to it
Example
new ExpectMessageBuilder(
`Expected ${place.name} to ${place.not} equal ${place.expected.value}`
)
.suffix(", but it was not.")
.negationSuffix(", but it did")
.trailingFailureSuffix(` because ${place.reason}`);
// Would be the same as
new ExpectMessageBuilder(
`Expected ${place.name} to equal ${place.expected.value},
but it was not because ${place.reason}`,
`Expected ${place.name} to NOT equal ${place.expected.value},
but it did because ${place.reason}`,
);