summaryrefslogtreecommitdiff
path: root/test/parallel/test-safe-get-env.js
blob: 0bee9971dbb3ebb2a154d9edc841667fc9ddd1a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
// Flags: --expose_internals

require('../common');
const assert = require('assert');
const { internalBinding } = require('internal/test/binding');
const { safeGetenv } = internalBinding('credentials');

// FIXME(joyeecheung): this test is not entirely useful. To properly
// test this we could create a mismatch between the effective/real
// group/user id of a Node.js process and see if the environment variables
// are no longer available - but that might be tricky to set up reliably.

for (const oneEnv in process.env) {
  assert.strictEqual(
    safeGetenv(oneEnv),
    process.env[oneEnv]
  );
}