@rbxts/expect > ExpectMessageBuilder > path
ExpectMessageBuilder.path() method
Sets a path to use for the "actual" variable, when dealing with nested tests.
Signature:
path(str?: string): this;
Parameters
Parameter | Type | Description |
---|---|---|
str | string | (Optional) A displayable value to use as the path, or undefined to reset it to empty. |
Returns:
this
This instance, for chaining.
Remarks
If you're using a proxy, this will be automatically populated.
Example
Given the message:
new ExpectMessageBuilder(
`${place.path} - Expected ${place.actual.value} to ${place.not} have a length
of ${place.expected.value}`
);
For messages with paths:
parent.cars - Expected '["Tesla","Civic"]' to have a length of '3'
For messages without paths:
- Expected '["Tesla","Civic"]' to have a length of '3'