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

Function formatLines

packages/jest-snapshot/src/__tests__/printSnapshot.test.ts:150–162  ·  view source on GitHub ↗
(chalkInstance: chalk.Chalk)

Source from the content-addressed store, hash-verified

148
149 // Simulate comparison lines from printSnapshotAndReceived.
150 const formatLines = (chalkInstance: chalk.Chalk) => {
151 const aColor = getSnapshotColorForChalkInstance(chalkInstance);
152 const bColor = getReceivedColorForChalkInstance(chalkInstance);
153 const cColor = chalkInstance.dim;
154 const changeLineTrailingSpaceColor = noColor;
155 const commonLineTrailingSpaceColor = chalkInstance.bgYellow;
156
157 return [
158 aColor(`- delete 1${changeLineTrailingSpaceColor(' ')}`),
159 cColor(` common 2${commonLineTrailingSpaceColor(' ')}`),
160 bColor('+ insert 0'),
161 ].join('\n');
162 };
163
164 const expected0 = '- delete 1 \n common 2 \n+ insert 0';
165 const expected1 =

Callers 1

Tested by

no test coverage detected