fix(test): increase test timeout for update checks and tune fetch timeout

This commit is contained in:
gitea committed 2026-09-02 15:47:25 +08:00
1 parent 70367cc058
commit 3098c8f5bc
3 files changed
+6 -6

No files matched your search

+3 -3
View File
@@ -178,7 +178,7 @@ describe("CLI version & help handling", () => {
expect(parsed).toHaveProperty("behindCount");
expect(parsed).toHaveProperty("pendingReleases");
expect(Array.isArray(parsed.pendingReleases)).toBe(true);
});
}, 20000);
test("changelog command outputs release history list", () => {
const result = runCli(["changelog", "--limit", "5"]);
@@ -186,7 +186,7 @@ describe("CLI version & help handling", () => {
const parsed = JSON.parse(result.stdout.trim());
expect(parsed.currentVersion).toBe(VERSION);
expect(Array.isArray(parsed.releases)).toBe(true);
});
}, 20000);
test("rejects downgrade to older version when target version is lower", () => {
const result = runCli(["update", "0.3.3"]);
@@ -204,7 +204,7 @@ describe("CLI version & help handling", () => {
const parsed = JSON.parse(result.stdout.trim());
expect(parsed).toHaveProperty("latestVersion");
expect(parsed.updated).toBe(false);
});
}, 20000);
});
function makeConfigEnv(): Record<string, string> {
+2 -2
View File
@@ -326,7 +326,7 @@ async function fetchGitHubReleases(repo: string, limit = 20): Promise<GitHubRele
for (const url of urls) {
try {
const res = await fetch(url, { headers, signal: AbortSignal.timeout(5000) });
const res = await fetch(url, { headers, signal: AbortSignal.timeout(3000) });
if (!res.ok) continue;
const json = (await res.json()) as Array<{
tag_name?: string;
@@ -397,7 +397,7 @@ async function fetchGitHubRelease(repo: string, targetVersion?: string): Promise
for (const url of urls) {
try {
const res = await fetch(url, { headers, signal: AbortSignal.timeout(5000) });
const res = await fetch(url, { headers, signal: AbortSignal.timeout(3000) });
if (!res.ok) continue;
const json = (await res.json()) as {
tag_name?: string;