(output: unknown, format: OutputFormat)
| 128 | } |
| 129 | |
| 130 | export function serializeOutputForFile(output: unknown, format: OutputFormat): string { |
| 131 | const unwrapped = unwrapFunctionExecuteOutput(output) |
| 132 | |
| 133 | if (typeof unwrapped === 'string') return unwrapped |
| 134 | |
| 135 | if (format === 'csv') { |
| 136 | const rows = extractTabularData(unwrapped) |
| 137 | if (rows && rows.length > 0) { |
| 138 | return convertRowsToCsv(rows) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | return JSON.stringify(unwrapped, null, 2) |
| 143 | } |
| 144 | |
| 145 | export interface OutputFileDeclaration { |
| 146 | path: string |
no test coverage detected