( diagnostics: ts.Diagnostic[], source: string, )
| 53 | } |
| 54 | |
| 55 | function formatDiagnostics( |
| 56 | diagnostics: ts.Diagnostic[], |
| 57 | source: string, |
| 58 | ): string { |
| 59 | return diagnostics |
| 60 | .map((d) => { |
| 61 | const message = ts.flattenDiagnosticMessageText(d.messageText, "\n"); |
| 62 | if (d.file && d.start !== undefined) { |
| 63 | const { line, character } = d.file.getLineAndCharacterOfPosition( |
| 64 | d.start, |
| 65 | ); |
| 66 | const lines = source.split("\n"); |
| 67 | const ctx = lines[line] ?? ""; |
| 68 | return ` line ${line + 1}:${character + 1}: ${message}\n | ${ctx}`; |
| 69 | } |
| 70 | return ` ${message}`; |
| 71 | }) |
| 72 | .join("\n"); |
| 73 | } |
| 74 | |
| 75 | describe("README.md", () => { |
| 76 | it("exists and has substantive content", () => { |
no test coverage detected
searching dependent graphs…