Remove line/col for all lib file diagnostics in baselines, completions (#52380)

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
Jake Bailey
2023-02-01 09:33:01 -08:00
committed by GitHub
parent d656487fca
commit d32118c7f9
8 changed files with 43 additions and 26 deletions

View File

@@ -2046,6 +2046,22 @@ export class TestState {
? entry.displayParts.map(p => p.text).join("").split("\n")
: [`(${entry.kindModifiers}${entry.kind}) ${entry.name}`])
);
for (const r of result) {
for (const entry of r.item.entries ?? ts.emptyArray) {
for (const tag of entry.tags ?? ts.emptyArray) {
for (const part of tag.text ?? ts.emptyArray) {
if (part.kind === "linkName") {
const link = part as ts.JSDocLinkDisplayPart;
if (/lib(?:.*)\.d\.ts$/.test(link.target.fileName)) {
// The object literal isn't a complete TextSpan, but we're only going to
// use these results in the baseline for diffing, so just overwrite.
(link.target.textSpan as any) = { start: "--", length: "--" };
}
}
}
}
}
}
Harness.Baseline.runBaseline(baselineFile, annotations + "\n\n" + stringify(result));
}

View File

@@ -616,7 +616,11 @@ export namespace Compiler {
}
}
yield [diagnosticSummaryMarker, Utils.removeTestPathPrefixes(minimalDiagnosticsToString(diagnostics, options && options.pretty)) + IO.newLine() + IO.newLine(), diagnostics.length];
let topDiagnostics = minimalDiagnosticsToString(diagnostics, options && options.pretty);
topDiagnostics = Utils.removeTestPathPrefixes(topDiagnostics);
topDiagnostics = topDiagnostics.replace(/^(lib(?:.*)\.d\.ts)\(\d+,\d+\)/igm, "$1(--,--)");
yield [diagnosticSummaryMarker, topDiagnostics + IO.newLine() + IO.newLine(), diagnostics.length];
// Report global errors
const globalErrors = diagnostics.filter(err => !err.file);