We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 15c7428 commit 2ca5d75Copy full SHA for 2ca5d75
tests/dts/unit/run.js
@@ -29,6 +29,18 @@ describe("Unit tests for dts files", () => {
29
/** @type {import("typescript").Diagnostic[]} */
30
const diagnostics = ts.getPreEmitDiagnostics(program);
31
32
- expect(diagnostics).toEqual([]);
+ expect(diagnostics.map(formatDiagnostic)).toEqual([]);
33
});
34
35
+
36
+/**
37
+ * @param {import("typescript").Diagnostic} diagnostic
38
+ */
39
+function formatDiagnostic({ file, start, code, messageText }) {
40
+ let location = "";
41
+ if (file) {
42
+ const { line, character } = ts.getLineAndCharacterOfPosition(file, start);
43
+ location = `${file.fileName}:${line + 1}:${character + 1} `;
44
+ }
45
+ return `${location}TS${code}: ${messageText}`;
46
+}
0 commit comments