Skip to main content

@rbxts/expect > Placeholder

Placeholder interface

Utility interface for specifying dynamic variables in expect error messages.

Signature:

interface Placeholder 

Remarks

At build time, the variables placed via this interface will be populated with their respective values.

This allows you to define a static string, while still specifying the location of certain variables—without needing to know their values.

Example

new ExpectMessageBuilder(
`Expected ${place.name} to ${place.not} equal ${place.expected.value}`
);

Properties

Property

Modifiers

Type

Description

actual

ActualPlaceholder

The "actual" variable in an expect() statement.

expected

ExpectedPlaceholder

The "expected" variable in an expect() statement.

index

string

A placeholder for array indices.

name

string

A utility placeholder for either the path, or the actual value.

Messages can configure their own names as well.

nil

string

A placeholder for the word "nil".

not

string

A placeholder for the word "NOT", that will only be populated when the assertion is negated.

path

string

A utility placeholder the path on nested variables.

reason

string

A utility placeholder for describing why the check failed.

undefined

string

A placeholder for the word "nil".