Skip to content

Commit

Permalink
fix(ext/node): support delete process.env.var (denoland#23647)
Browse files Browse the repository at this point in the history
  • Loading branch information
satyarohith committed May 2, 2024
1 parent 66b66de commit 56ba7f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/node/polyfills/_process/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
});

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/unit_node/process_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
});

Expand Down

0 comments on commit 56ba7f3

Please sign in to comment.