mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2026-11-13 21:36:56 +00:00
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:
parent
f10c73c117
commit
203f9ff1fd
|
|
@ -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-/);
|
||||
|
|
|
|||
Loading…
Reference in a new issue