Assert.configure()

Syntax

interface AssertConfiguration {
    prefixed?: boolean;
    stringifyOptions?: StringifyOptions;
}

function configure(configuration: AssertConfiguration): void

Allows you to configure various behavior in regards to the assertion messages.

Parameters
configuration

A configuration object defining any of the below properties.

configuration.prefixed Optional

If true, all assertion error messages are prefixed with “Assertion failed”.

Default is true.

configuration.stringifyOptions Optional

All non-generic assertion functions (i.e. functions where the condition to test is defined by the function, not by callers) use Objects.stringify() to convert the values they test into strings if they fail. You can specify this argument to change the behavior of Objects.stringify() in those cases.

The default configuration is { truncateContents: true }.

Example

import { Numbers } from 'potence';

Assert.configure({
    prefixed: false,
    stringifyOptions: {
        truncateContents: true
    }
});