Interface MockableOptions

Description

Options for the Mockable decorator.

interface MockableOptions {
    depth?: number;
    importMeta?: ImportMeta;
    name?: string;
    snapshotDir?: string;
    statics?: string[][];
    symbols?: boolean;
}

Properties

depth?: number

Description

Maximum depth for recursive wrapping of nested results in a MockHandler. When the wrapping depth reaches this value, results are serialized directly instead of being wrapped. Default: Infinity (unlimited).

importMeta?: ImportMeta

Description

Pass import.meta from the calling test module to resolve the snapshot directory relative to the test file: __snapshots__/ alongside the test. When provided, snapshotDir is ignored.

name?: string

Description

Custom snapshot class name for mock(). Automatically derived when not set: class constructors use their own name; plain objects use Object_<hash> (hash of sorted method names).

snapshotDir?: string

Description

Override snapshot directory (default: __snapshots__ relative to the calling test file when importMeta is provided, otherwise tests/__snapshots__).

statics?: string[][]

Description

Static method wrapping configuration. Each element is a list of method names. Predefined lists like SEQUELIZE_STATICS can be used directly.

symbols?: boolean

Description

Enable serialization of symbol values (default: false). When enabled, symbols are serialized as their description string and restored via Symbol(). Disabled by default to avoid breaking existing snapshots.