What to declassify
Optional
spaces: string | numberThe declassified payload
For example, the following will reveal the expected sky color, but not the actual incorrect sky color, in the thrown error's message:
sky.color === expectedColor || Fail`${sky.color} should be ${quote(expectedColor)}`;
The normal convention is to locally rename details
to X
and quote
to q
like const { details: X, quote: q } = assert;
, so the above example would then be
sky.color === expectedColor || Fail`${sky.color} should be ${q(expectedColor)}`;
Generated using TypeDoc
To "declassify" and quote a substitution value used in a
details`...`
template literal, enclose that substitution expression in a call toquote
. This makes the value appear quoted (as if withJSON.stringify
) in the message of the thrown error. The payload itself is still passed unquoted to the console as it would be withoutquote
.