earl icon indicating copy to clipboard operation
earl copied to clipboard

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

Open dhardtke opened this issue 2 years ago • 0 comments

(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?

dhardtke avatar May 17 '23 21:05 dhardtke