• To "declassify" and quote a substitution value used in a details`...` template literal, enclose that substitution expression in a call to quote. This makes the value appear quoted (as if with JSON.stringify) in the message of the thrown error. The payload itself is still passed unquoted to the console as it would be without quote.

    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)}`;
    

    Parameters

    • payload: any

      What to declassify

    • Optionalspaces: string | number

    Returns StringablePayload