diff --git a/ext/node/polyfills/_process/process.ts b/ext/node/polyfills/_process/process.ts index 57450a5214..046169b08a 100644 --- a/ext/node/polyfills/_process/process.ts +++ b/ext/node/polyfills/_process/process.ts @@ -88,6 +88,10 @@ export const env: InstanceType & Record = return true; // success }, has: (_target, prop) => typeof denoEnvGet(String(prop)) === "string", + deleteProperty(_target, key) { + Deno.env.delete(String(key)); + return true; + }, }); /** diff --git a/tests/unit_node/process_test.ts b/tests/unit_node/process_test.ts index 0ae0c2a7ac..b92be2f3ca 100644 --- a/tests/unit_node/process_test.ts +++ b/tests/unit_node/process_test.ts @@ -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); }, });