MCPcopy
hub / github.com/jestjs/jest / printReceivedArrayContainExpectedItem

Function printReceivedArrayContainExpectedItem

packages/expect/src/print.ts:47–58  ·  view source on GitHub ↗
(
  received: Array<unknown>,
  index: number,
)

Source from the content-addressed store, hash-verified

45// However, items have default stringify depth (instead of depth - 1)
46// so expected item looks consistent by itself and enclosed in the array.
47export const printReceivedArrayContainExpectedItem = (
48 received: Array<unknown>,
49 index: number,
50): string =>
51 RECEIVED_COLOR(
52 `[${received
53 .map((item, i) => {
54 const stringified = stringify(item);
55 return i === index ? INVERTED_COLOR(stringified) : stringified;
56 })
57 .join(', ')}]`,
58 );
59
60export const printCloseTo = (
61 receivedDiff: number,

Callers 1

messageFunction · 0.90

Calls 1

stringifyFunction · 0.90

Tested by

no test coverage detected