xref: /third_party/node/test/parallel/test-safe-get-env.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci// Flags: --expose-internals
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cirequire('../common');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ciconst { internalBinding } = require('internal/test/binding');
71cb0ef41Sopenharmony_ciconst { safeGetenv } = internalBinding('credentials');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci// FIXME(joyeecheung): this test is not entirely useful. To properly
101cb0ef41Sopenharmony_ci// test this we could create a mismatch between the effective/real
111cb0ef41Sopenharmony_ci// group/user id of a Node.js process and see if the environment variables
121cb0ef41Sopenharmony_ci// are no longer available - but that might be tricky to set up reliably.
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_cifor (const oneEnv in process.env) {
151cb0ef41Sopenharmony_ci  assert.strictEqual(
161cb0ef41Sopenharmony_ci    safeGetenv(oneEnv),
171cb0ef41Sopenharmony_ci    process.env[oneEnv]
181cb0ef41Sopenharmony_ci  );
191cb0ef41Sopenharmony_ci}
20

Indexes created Thu Nov 07 10:32:03 CST 2024