This commit is contained in:
Kenji Fujita 2026-05-22 16:55:04 +08:00 committed by GitHub
commit 7afd105864
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -0,0 +1,13 @@
import { describe, it } from "node:test";
import assert from "node:assert";
import { mergeSafeChainProxyEnvironmentVariables } from "./registryProxy.js";
describe("registryProxy.environmentVariables", () => {
it("should copy environment variables with empty string values", () => {
const envVars = mergeSafeChainProxyEnvironmentVariables({
EMPTY_VAR: "",
});
assert.strictEqual(envVars.EMPTY_VAR, "");
});
});

View file

@ -66,7 +66,7 @@ export function mergeSafeChainProxyEnvironmentVariables(env) {
// So we only copy the variable if it's not already set in a different case
const upperKey = key.toUpperCase();
if (!proxyEnv[upperKey] && env[key]) {
if (!(upperKey in proxyEnv) && env[key] !== undefined) {
proxyEnv[key] = env[key];
}
}