MCPcopy
hub / github.com/vercel-labs/just-bash / formatDiagnostics

Function formatDiagnostics

packages/just-bash-executor/src/docs.test.ts:55–73  ·  view source on GitHub ↗
(
  diagnostics: ts.Diagnostic[],
  source: string,
)

Source from the content-addressed store, hash-verified

53}
54
55function 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
75describe("README.md", () => {
76 it("exists and has substantive content", () => {

Callers 1

docs.test.tsFile · 0.85

Calls 1

splitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…