Skip to content

Disable loupe's customInspect option to avoid collisions. #1708

@OldStarchy

Description

@OldStarchy

One of my objects has a .inspect function that collides with chai/loupe's customInspect setting.

The options provided to loupe's inspect are hardcoded (which is why I'm opening the issue here rather than in loupe):

let options = {
colors: colors,
depth: typeof depth === 'undefined' ? 2 : depth,
showHidden: showHidden,
truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
};

Setting customInspect: false below would disable the check.
https://github.com/chaijs/loupe/blob/b5b084b8429a3ad2ed4e8abfab2e3cdef92ba6e2/src/index.ts#L99-L101

There's already an issue over there questioning the validity of using a string-keyd 'inspect' function given that there is support for Symbols widely available chaijs/loupe#74, but it seems to have been missed by the maintainers of the repo.
https://github.com/chaijs/loupe/blob/b5b084b8429a3ad2ed4e8abfab2e3cdef92ba6e2/src/index.ts#L28-L30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions