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 <noreply@anthropic.com>
This commit is contained in:
awalsh128 2026-11-05 16:48:04 -08:00
parent f10c73c117
commit 203f9ff1fd

View file

@ -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-/);