fix(ext/node): support delete process.env.var (#23647)

Closes https://github.com/denoland/deno/issues/23641
This commit is contained in:
Satya Rohith 2024-05-02 12:10:22 +05:30 committed by GitHub
parent 66b66de96a
commit 56ba7f3c23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -88,6 +88,10 @@ export const env: InstanceType<ObjectConstructor> & Record<string, string> =
return true; // success
},
has: (_target, prop) => typeof denoEnvGet(String(prop)) === "string",
deleteProperty(_target, key) {
Deno.env.delete(String(key));
return true;
},
});
/**

View file

@ -416,6 +416,9 @@ Deno.test({
assertEquals(process.env.HELLO, "false");
process.env.HELLO = "WORLD";
assertEquals(process.env.HELLO, "WORLD");
delete process.env.HELLO;
assertEquals(process.env.HELLO, undefined);
},
});