(options: CliTextProcessorOptions)
| 106 | type RunStateEvent = Parameters<XcodebuildRunStateHandle['push']>[0]; |
| 107 | |
| 108 | function createCliTextProcessor(options: CliTextProcessorOptions): TranscriptRenderer { |
| 109 | const { |
| 110 | interactive, |
| 111 | sink, |
| 112 | suppressWarnings, |
| 113 | showTestTiming, |
| 114 | filePathRenderStyle, |
| 115 | includeHeaderDetails, |
| 116 | includeNextSteps, |
| 117 | } = options; |
| 118 | const groupedCompilerErrors: CompilerErrorRenderItem[] = []; |
| 119 | const groupedWarnings: CompilerWarningRenderItem[] = []; |
| 120 | const groupedTestFailures: TestFailureRenderItem[] = []; |
| 121 | const collectedTestCaseResults: TestCaseResultRenderItem[] = []; |
| 122 | const parserStates = new Map<XcodebuildOperation, XcodebuildParserState>(); |
| 123 | let pendingTransientRuntimeLine: string | null = null; |
| 124 | let diagnosticBaseDir: string | null = null; |
| 125 | let hasDurableRuntimeContent = false; |
| 126 | let lastVisibleEventType: TextRenderableItem['type'] | null = null; |
| 127 | let lastStatusLineLevel: StatusRenderItem['level'] | null = null; |
| 128 | let lastSummaryStatus: 'SUCCEEDED' | 'FAILED' | null = null; |
| 129 | let structuredOutput: StructuredToolOutput | undefined; |
| 130 | let sawIncomingHeaderEvent = false; |
| 131 | let sawIncomingNonHeaderEvent = false; |
| 132 | let sawIncomingSummaryEvent = false; |
| 133 | let sawIncomingNonSummaryEvent = false; |
| 134 | let nextSteps: readonly NextStep[] = []; |
| 135 | let nextStepsRuntime: RuntimeKind | undefined; |
| 136 | let sawProgressNextSteps = false; |
| 137 | let lastRenderedTestProgressKey: string | null = null; |
| 138 | let pendingStreamedSummary: SummaryTextBlock | null = null; |
| 139 | |
| 140 | function writeDurable(text: string): void { |
| 141 | sink.clearTransient(); |
| 142 | pendingTransientRuntimeLine = null; |
| 143 | hasDurableRuntimeContent = true; |
| 144 | sink.writeDurable(text); |
| 145 | } |
| 146 | |
| 147 | function writeSection(text: string): void { |
| 148 | sink.clearTransient(); |
| 149 | pendingTransientRuntimeLine = null; |
| 150 | hasDurableRuntimeContent = true; |
| 151 | sink.writeSection(text); |
| 152 | } |
| 153 | |
| 154 | function flushPendingTransientRuntimeLine(): void { |
| 155 | if (pendingTransientRuntimeLine) { |
| 156 | writeDurable(pendingTransientRuntimeLine); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | function flushGroupedDiagnostics(includeCompilerErrors: boolean): boolean { |
| 161 | const diagOpts = { baseDir: diagnosticBaseDir ?? undefined }; |
| 162 | const diagnosticSections: string[] = []; |
| 163 | |
| 164 | if (includeCompilerErrors && groupedCompilerErrors.length > 0) { |
| 165 | diagnosticSections.push(formatGroupedCompilerErrors(groupedCompilerErrors, diagOpts)); |
no outgoing calls
no test coverage detected