Fix expect call in dts test (#15766)
This commit is contained in:
1 parent
15c742844f
commit
2ca5d757b7
1 file changed
+13
-1
+13
-1
@@ -29,6 +29,18 @@ describe("Unit tests for dts files", () => {
|
||||
/** @type {import("typescript").Diagnostic[]} */
|
||||
const diagnostics = ts.getPreEmitDiagnostics(program);
|
||||
|
||||
expect(diagnostics).toEqual([]);
|
||||
expect(diagnostics.map(formatDiagnostic)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {import("typescript").Diagnostic} diagnostic
|
||||
*/
|
||||
function formatDiagnostic({ file, start, code, messageText }) {
|
||||
let location = "";
|
||||
if (file) {
|
||||
const { line, character } = ts.getLineAndCharacterOfPosition(file, start);
|
||||
location = `${file.fileName}:${line + 1}:${character + 1} `;
|
||||
}
|
||||
return `${location}TS${code}: ${messageText}`;
|
||||
}
|
||||
Reference in new issue
Block a user