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

Function joinDiffs

packages/jest-snapshot/src/printSnapshot.ts:148–164  ·  view source on GitHub ↗
(
  diffs: Array<Diff>,
  op: number,
  hasCommon: boolean,
)

Source from the content-addressed store, hash-verified

146// * include change substrings which have argument op
147// with change color only if there is a common substring
148const joinDiffs = (
149 diffs: Array<Diff>,
150 op: number,
151 hasCommon: boolean,
152): string =>
153 diffs.reduce(
154 (reduced: string, diff: Diff): string =>
155 reduced +
156 (diff[0] === DIFF_EQUAL
157 ? diff[1]
158 : diff[0] === op
159 ? hasCommon
160 ? INVERTED_COLOR(diff[1])
161 : diff[1]
162 : ''),
163 '',
164 );
165
166const isLineDiffable = (received: unknown): boolean => {
167 const receivedType = getType(received);

Callers 1

printSnapshotAndReceivedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected