Skip to content

[Docs]: IDE documentation for expect toContain(item) missing some key information that the documentation page has #15788

@justamanpop

Description

@justamanpop

Page(s)

jest docs website: https://jestjs.io/docs/expect#tocontainitem

documentation that shows up in IDE: https://github.com/jestjs/jest/blob/main/packages/expect/src/types.ts#L211

Description

The jest documentation page for expect.toContain(item) states:

Use .toContain when you want to check that an item is in an array. For testing the items in the 
array, this uses ===, a strict equality check. .toContain can also check whether a string is a substring of another string.

But in the comments in jest/packages/expect/src/types.ts file (which is what shows up when hovering over expect matchers in the IDE), it only mentions that it can check if an item is in a list.

This meant a user cannot know it worked for asserting substrings from within the IDE and had to open the docs in a browser to find out

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions