Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/api/process.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -708,6 +708,16 @@ console.log(process.env.TEST);
// => undefined
```

On Windows operating systems, environment variables are case-insensitive.

Example:

```js
process.env.TEST = 1;
console.log(process.env.test);
// => 1
```

## process.emitWarning(warning[, name][, ctor])
<!-- YAML
added: v6.0.0
Expand Down
16 changes: 15 additions & 1 deletion test/parallel/test-process-env.js
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
'use strict';

require('../common');
constcommon=require('../common');
constassert=require('assert');

// changes in environment should be visible to child processes
Expand DownExpand Up@@ -67,3 +67,17 @@ assert.equal(3, date.getUTCHours());
assert.equal(5, date.getHours());
*/
/* eslint-enable max-len */

// Environment variables should be case-insensitive on Windows, and
// case-sensitive on other platforms.
process.env.TEST='test';
assert.strictEqual(process.env.TEST,'test');
// Check both mixed case and lower case, to avoid any regressions that might
// simply convert input to lower case.
if(common.isWindows){
assert.strictEqual(process.env.test,'test');
assert.strictEqual(process.env.teST,'test');
}else{
assert.strictEqual(process.env.test,undefined);
assert.strictEqual(process.env.teST,undefined);
}