From 203f9ff1fdd38cc777ce5c6b7a62d5fa9e2b64a8 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Thu, 5 Nov 2026 16:48:04 -0800 Subject: [PATCH] test: clear GITHUB_RUN_ID when testing the run ID fallback GitHub Actions always sets GITHUB_RUN_ID, so the fallback test failed once CI could run the tests at all. Co-Authored-By: Claude Opus 5.5 --- test/instrumentation.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/instrumentation.test.ts b/test/instrumentation.test.ts index f678cb4..e4ea0b4 100644 --- a/test/instrumentation.test.ts +++ b/test/instrumentation.test.ts @@ -4,6 +4,7 @@ import { afterEach, describe, expect, it, vi } from "vitest"; describe("instrumentation", () => { afterEach(() => { vi.restoreAllMocks(); + vi.unstubAllEnvs(); }); const ARTIFACT_FILENAMES = [ @@ -32,6 +33,8 @@ describe("instrumentation", () => { it("constructor generates a random runId when not provided", () => { const dir = "/path/to/artifacts"; const debug = false; + // GitHub Actions sets this, so clear it to test the fallback. + vi.stubEnv("GITHUB_RUN_ID", undefined); const artifacts = new Artifacts(dir, ARTIFACT_FILENAMES, debug); expect(artifacts.runId).toMatch(/^ghrunid-notfound-/);