Skip to content

expect.toInclude with expect.subset() does not generate helpful error texts #284

@dhardtke

Description

@dhardtke

(Follow-up to #283 but an issue that can be tackled separately)

Given:

{ _id: 42, foo: 'bar' },
  { _id: 43, foo: 'baz' },
  { _id: 44, lorem: 'ipsum' }
];
expect(items).toInclude([
  expect.subset({ x: 'y' }),
])

If toInclude fails the generated error message is not that helpful:

Uncaught The value [3 entries] does not include [expect.?], but it was expected to.
    at expect().toInclude

It would be great if we could see or opt-in to see the full object or maybe parts of the object that do not include what was expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions