node/test/parallel/test-process-env-delete.js
Himself65 e6a7300a10
process: disallow some uses of Object.defineProperty() on process.env
Disallow the use of Object.defineProperty() to hide entries in
process.env or make them immutable.

PR-URL: https://github.com/nodejs/node/pull/28006
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-04-04 09:24:17 +01:00

14 lines
361 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
process.env.foo = 'foo';
assert.strictEqual(process.env.foo, 'foo');
process.env.foo = undefined;
assert.strictEqual(process.env.foo, 'undefined');
process.env.foo = 'foo';
assert.strictEqual(process.env.foo, 'foo');
delete process.env.foo;
assert.strictEqual(process.env.foo, undefined);