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

Function getRightAlignedPrinter

packages/expect/src/spyMatchers.ts:96–107  ·  view source on GitHub ↗
(label: string)

Source from the content-addressed store, hash-verified

94// Given a label, return a function which given a string,
95// right-aligns it preceding the colon in the label.
96const getRightAlignedPrinter = (label: string): PrintLabel => {
97 // Assume that the label contains a colon.
98 const index = label.indexOf(':');
99 const suffix = label.slice(index);
100
101 return (string: string, isExpectedCall: boolean) =>
102 (isExpectedCall
103 ? `->${' '.repeat(Math.max(0, index - 2 - string.length))}`
104 : ' '.repeat(Math.max(index - string.length))) +
105 string +
106 suffix;
107};
108
109type IndexedCall = [number, Array<unknown>];
110

Callers 3

printReceivedResultsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected