diff --git a/tests/windows-symlink-capability.js b/tests/windows-symlink-capability.js index b9470c41..0b2d3a27 100644 --- a/tests/windows-symlink-capability.js +++ b/tests/windows-symlink-capability.js @@ -3,7 +3,9 @@ import fs from "node:fs"; /** * Only symbolic-link fixture creation is optional on non-admin Windows * workstations without Developer Mode. Production link rejection is unchanged. - * Our Windows CI must exercise the real symlink case, never waive it. + * Audited GitHub Actions Windows CI must exercise the real symlink case, never + * waive it. The local job runner also sets CI=true but is a workstation, so only + * GITHUB_ACTIONS (never an arbitrary CI flag) makes the privilege mandatory. */ export function tryFileSymlink(t, target, link) { try { @@ -16,7 +18,7 @@ export function tryFileSymlink(t, target, link) { ) { throw error; } - if (process.env.CI === "true") { + if (process.env.GITHUB_ACTIONS === "true") { throw new Error("WINDOWS_CI_SYMLINK_PRIVILEGE_REQUIRED", { cause: error, }); diff --git a/tests/windows-symlink-capability.test.js b/tests/windows-symlink-capability.test.js index c2ee7ce6..9a403c6f 100644 --- a/tests/windows-symlink-capability.test.js +++ b/tests/windows-symlink-capability.test.js @@ -12,18 +12,24 @@ test("Windows symlink fixtures diagnose non-admin privilege without weakening CI error.code = "EPERM"; throw error; }); - const prior = process.env.CI; + const prior = process.env.GITHUB_ACTIONS; + const priorCi = process.env.CI; try { - delete process.env.CI; - assert.equal(tryFileSymlink(t, "target.txt", "link.txt"), false); + delete process.env.GITHUB_ACTIONS; + // The local job runner exports CI=true; that alone must not make a + // non-admin workstation fail, it is not the audited CI. process.env.CI = "true"; + assert.equal(tryFileSymlink(t, "target.txt", "link.txt"), false); + process.env.GITHUB_ACTIONS = "true"; assert.throws( () => tryFileSymlink(t, "target.txt", "link.txt"), /WINDOWS_CI_SYMLINK_PRIVILEGE_REQUIRED/, ); } finally { - if (prior === undefined) delete process.env.CI; - else process.env.CI = prior; + if (prior === undefined) delete process.env.GITHUB_ACTIONS; + else process.env.GITHUB_ACTIONS = prior; + if (priorCi === undefined) delete process.env.CI; + else process.env.CI = priorCi; } });