From 9074f08475591fe1dc730936b0aeab30bf5438ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Fri, 11 Sep 2026 21:14:23 +0200 Subject: [PATCH] test(cli): give the e2e suite a realistic timeout The CLI e2e tests spawn the built CLI and call the live Argos API, so they are bound by network latency rather than local compute. Most ran on vitest's 5s default, which is too tight on a loaded runner: in CI run 34607908169 the `e2e-core (24, macos-latest)` cell failed because `build get 999999` timed out at 5000ms, while the other 8 matrix cells passed. Split vitest.config.ts into `unit` and `e2e` projects so the e2e files get a 30s testTimeout, plus a matching 30s hookTimeout for the six files that seed state from the API in `beforeAll` (the default hook budget is 10s). Unit tests keep the 5s default. That makes the hand-written per-test timeouts redundant, so drop them from comment, deploy, skip, upload, upload-oidc and upload-tokenless. The three e2e scripts keep working: they pass path and tag filters, which vitest applies across projects. Co-Authored-By: Claude Opus 5 --- packages/cli/e2e/comment.test.ts | 2 +- packages/cli/e2e/deploy.test.ts | 2 +- packages/cli/e2e/skip.test.ts | 2 +- packages/cli/e2e/upload-oidc.test.ts | 2 +- packages/cli/e2e/upload-tokenless.test.ts | 2 +- packages/cli/e2e/upload.test.ts | 5 +-- packages/cli/vitest.config.ts | 41 ++++++++++++++++++++--- 7 files changed, 45 insertions(+), 11 deletions(-) diff --git a/packages/cli/e2e/comment.test.ts b/packages/cli/e2e/comment.test.ts index 929de8e7..1dbf68f2 100644 --- a/packages/cli/e2e/comment.test.ts +++ b/packages/cli/e2e/comment.test.ts @@ -100,5 +100,5 @@ describe("argos comment", () => { runAs(["comment", "delete", buildUrl, id]).stdout, ); expect(deleted.id).toBe(id); - }, 30000); + }); }); diff --git a/packages/cli/e2e/deploy.test.ts b/packages/cli/e2e/deploy.test.ts index 9f1ca9ac..da21f5f7 100644 --- a/packages/cli/e2e/deploy.test.ts +++ b/packages/cli/e2e/deploy.test.ts @@ -12,4 +12,4 @@ test("deploys a static site with HTML and CSS assets", () => { expect(deployResult.combined).toContain("Deployed:"); expect(deployResult.combined).toMatch(/https?:\/\/\S+/); -}, 10000); +}); diff --git a/packages/cli/e2e/skip.test.ts b/packages/cli/e2e/skip.test.ts index 2fdf001b..ac7c3be5 100644 --- a/packages/cli/e2e/skip.test.ts +++ b/packages/cli/e2e/skip.test.ts @@ -4,7 +4,7 @@ import { getRequiredEnv, run } from "./utils"; getRequiredEnv("ARGOS_TOKEN"); -test("skip returns a build URL", { timeout: 20_000 }, () => { +test("skip returns a build URL", () => { const buildName = `argos-cli-e2e-skipped-node-${process.env.NODE_VERSION}-${process.env.OS}`; const skipResult = run(["skip", "--build-name", buildName]); diff --git a/packages/cli/e2e/upload-oidc.test.ts b/packages/cli/e2e/upload-oidc.test.ts index aa28649b..5996f9d3 100644 --- a/packages/cli/e2e/upload-oidc.test.ts +++ b/packages/cli/e2e/upload-oidc.test.ts @@ -5,7 +5,7 @@ import { run } from "./utils"; // No ARGOS_TOKEN — authentication is handled via GitHub Actions OIDC. test( "upload returns a full build URL using OIDC authentication", - { tags: ["oidc"], timeout: 20_000 }, + { tags: ["oidc"] }, () => { const buildName = `argos-cli-e2e-oidc-node-${process.env.NODE_VERSION}-${process.env.OS}`; const uploadResult = run([ diff --git a/packages/cli/e2e/upload-tokenless.test.ts b/packages/cli/e2e/upload-tokenless.test.ts index 3ffbd031..bb59d26a 100644 --- a/packages/cli/e2e/upload-tokenless.test.ts +++ b/packages/cli/e2e/upload-tokenless.test.ts @@ -8,7 +8,7 @@ import { run } from "./utils"; // eslint-disable-next-line vitest/no-disabled-tests test.skip( "upload returns a full build URL using tokenless authentication", - { tags: ["tokenless"], timeout: 20_000 }, + { tags: ["tokenless"] }, () => { const buildName = `argos-cli-e2e-tokenless-node-${process.env.NODE_VERSION}-${process.env.OS}`; const uploadResult = run([ diff --git a/packages/cli/e2e/upload.test.ts b/packages/cli/e2e/upload.test.ts index 25787701..a0ee012d 100644 --- a/packages/cli/e2e/upload.test.ts +++ b/packages/cli/e2e/upload.test.ts @@ -6,8 +6,9 @@ getRequiredEnv("ARGOS_TOKEN"); // This test uploads the full __fixtures__ directory, which includes a 10MB PNG // stress fixture. That file is sharp-optimized, hashed, and uploaded to S3 over -// a real network connection, so a generous timeout is required to avoid flakes. -test("upload returns a full build URL", { timeout: 30_000 }, () => { +// a real network connection. It relies on the generous e2e timeout configured +// in vitest.config.ts. +test("upload returns a full build URL", () => { const buildName = `argos-cli-e2e-node-${process.env.NODE_VERSION}-${process.env.OS}`; const uploadResult = run([ "upload", diff --git a/packages/cli/vitest.config.ts b/packages/cli/vitest.config.ts index 7520dc07..e1d01139 100644 --- a/packages/cli/vitest.config.ts +++ b/packages/cli/vitest.config.ts @@ -1,7 +1,18 @@ -export default { +import { defineConfig } from "vitest/config"; + +/** + * The e2e suite spawns the built CLI and talks to the live Argos API, so every + * test is bound by network latency rather than by local compute. Vitest's + * default 5s budget is routinely too tight on a loaded CI runner, which shows + * up as a single matrix cell failing on a timeout while the others pass. + * + * Applied as a project-level default so individual tests and hooks don't have + * to carry hand-written timeouts. + */ +const E2E_TIMEOUT = 30_000; + +export default defineConfig({ test: { - environment: "node", - include: ["src/**/*.test.ts", "e2e/**/*.test.ts"], tags: [ { name: "oidc", @@ -12,5 +23,27 @@ export default { description: "Tokenless exchange tests.", }, ], + projects: [ + { + extends: true, + test: { + name: "unit", + environment: "node", + include: ["src/**/*.test.ts"], + }, + }, + { + extends: true, + test: { + name: "e2e", + environment: "node", + include: ["e2e/**/*.test.ts"], + testTimeout: E2E_TIMEOUT, + // Several e2e files seed state from the API in `beforeAll`, which is + // subject to the same latency (default hook budget is 10s). + hookTimeout: E2E_TIMEOUT, + }, + }, + ], }, -}; +});