Skip to main content

@rbxts/expect > ExpectMessageBuilderOptions > trimSpaces

ExpectMessageBuilderOptions.trimSpaces property

Trim the spaces around placeholders when they're absent.

Signature:

trimSpaces: boolean;

Remarks

This is different from trimWhiteSpace, in that this only pertains to the space around absent placeholders.

Example

Given the following message:

const baseMessage = new ExpectMessageBuilder(
`Expected ${place.actual.value} to ${place.not} equal ${place.expected.value}`
);

If the statement was not negated, that means that ${place.not} would be absent.

With trimSpaces: false

Expected 5 to   equal 5

With trimSpaces: true

Expected 5 to equal 5