Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/postGithubIssue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as path from "node:path";
import { artifactFolderUrlPlaceholder, getArtifactsApiUrlPlaceholder, type Metadata, metadataFileName, type RepoStatus, resultFileNameSuffix, type StatusCounts, type TsEntrypoint } from "./main.js";
import * as git from "./utils/gitUtils.js";
import * as pu from "./utils/packageUtils.js";
import { formatVersionComparison } from "./utils/markdownUtils.js";

const { argv } = process;

Expand Down Expand Up @@ -47,7 +48,7 @@ for (const path of metadataFilePaths) {
}


const title = `${entrypoint === "tsserver" || entrypoint === "fuzzer" ? `[ServerErrors][${language}]` : `[NewErrors]`} ${newTscResolvedVersion} vs ${oldTscResolvedVersion}`;
const title = `${entrypoint === "tsserver" || entrypoint === "fuzzer" ? `[ServerErrors][${language}]` : `[NewErrors]`} ${formatVersionComparison(newTscResolvedVersion ?? "", oldTscResolvedVersion)}`;

const description = entrypoint === "tsserver"
? `The following errors were reported by ${newTscResolvedVersion} vs ${oldTscResolvedVersion}`
Expand Down
4 changes: 4 additions & 0 deletions src/utils/markdownUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ export function formatPrComparison(oldVersion: string | undefined, newVersion: s
}
return `${asMarkdownInlineCode(oldVersion ?? "old")} and ${asMarkdownInlineCode(newVersion ?? "new")}`;
}

export function formatVersionComparison(newVersion: string, oldVersion: string | undefined): string {
return oldVersion ? `${newVersion} vs ${oldVersion}` : newVersion;
}
8 changes: 7 additions & 1 deletion test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { detectTypeScriptImplementation, detectTypeScriptNpmImplementation, down
import * as path from "node:path"
import { execFileAsync } from '../src/utils/execUtils.js';
import type { SpawnResult } from '../src/utils/execUtils.js';
import { formatPrComparison } from '../src/utils/markdownUtils.js';
import { formatPrComparison, formatVersionComparison } from '../src/utils/markdownUtils.js';
import { describe, expect, it, vi } from "vitest";

const testState = vi.hoisted(() => ({
Expand Down Expand Up @@ -116,6 +116,12 @@ describe("main", () => {
.toBe("`792ffccb90f548cd3bdd7fc0b44f0ca9e1b169a7` and `refs/pull/64558/merge`");
});

it("omits the comparison when there is no baseline version", () => {
expect(formatVersionComparison("main", undefined)).toBe("main");
expect(formatVersionComparison("main", "")).toBe("main");
expect(formatVersionComparison("7.0.0", "6.0.0")).toBe("7.0.0 vs 6.0.0");
});

it("detects tsgo from the root package name", () => {
expect(detectTypeScriptImplementation({ name: "typescript" })).toBe("strada");
expect(detectTypeScriptImplementation({ name: "typescript-go" })).toBe("corsa");
Expand Down
Loading