MCPcopy Index your code
hub / github.com/callstack/agent-device / formatReplayTestLiveProgressLine

Function formatReplayTestLiveProgressLine

src/replay/test/progress.ts:97–118  ·  view source on GitHub ↗
(
  event: ReplayTestStep,
  options: ReplayTestProgressFormatOptions,
  spinnerFrame: string,
)

Source from the content-addressed store, hash-verified

95}
96
97function formatReplayTestLiveProgressLine(
98 event: ReplayTestStep,
99 options: ReplayTestProgressFormatOptions,
100 spinnerFrame: string,
101): string {
102 const title = event.title?.trim();
103 const file = path.basename(event.file);
104 const useColor = supportsColor(process.stderr);
105 const spinner = formatReplayTestProgressSpinner(spinnerFrame, { useColor });
106 const shardSuffix = formatReplayTestProgressShardSuffix(event, { useColor });
107 const stepSuffix = formatReplayTestLiveProgressStepSuffix(event, { useColor });
108 const suffix = `${shardSuffix}${stepSuffix}`;
109 const prefix = `${spinner} `;
110 if (!title) return trimToColumns(`${prefix}${file}${suffix}`, options.columns);
111
112 const availableTitleColumns = Math.max(
113 0,
114 resolveColumns(options.columns) - visibleLength(prefix) - visibleLength(suffix),
115 );
116 const formattedTitle = trimToColumns(title, availableTitleColumns);
117 return trimToColumns(`${prefix}${formattedTitle}${suffix}`, options.columns);
118}
119
120function formatReplayTestProgressSpinner(
121 frame: string,

Callers 1

renderFunction · 0.85

Calls 7

supportsColorFunction · 0.90
trimToColumnsFunction · 0.85
resolveColumnsFunction · 0.85
visibleLengthFunction · 0.85

Tested by

no test coverage detected