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

Function printSnapshotName

packages/jest-snapshot/src/index.ts:57–70  ·  view source on GitHub ↗
(
  concatenatedBlockNames = '',
  hint = '',
  count: number,
)

Source from the content-addressed store, hash-verified

55// Display name in report when matcher fails same as in snapshot file,
56// but with optional hint argument in bold weight.
57const printSnapshotName = (
58 concatenatedBlockNames = '',
59 hint = '',
60 count: number,
61): string => {
62 const hasNames = concatenatedBlockNames.length > 0;
63 const hasHint = hint.length > 0;
64
65 return `Snapshot name: \`${
66 hasNames ? escapeBacktickString(concatenatedBlockNames) : ''
67 }${hasNames && hasHint ? ': ' : ''}${
68 hasHint ? BOLD_WEIGHT(escapeBacktickString(hint)) : ''
69 } ${count}\``;
70};
71
72function stripAddedIndentation(inlineSnapshot: string) {
73 // Find indentation if exists.

Callers 2

messageFunction · 0.85
_toMatchSnapshotFunction · 0.85

Calls 1

escapeBacktickStringFunction · 0.90

Tested by

no test coverage detected