xref: /third_party/node/test/parallel/test-process-env-sideeffects.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled();
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci// Test that read-only process.env access is considered to have no
61cb0ef41Sopenharmony_ci// side-effects by the inspector.
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciconst assert = require('assert');
91cb0ef41Sopenharmony_ciconst inspector = require('inspector');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciconst session = new inspector.Session();
121cb0ef41Sopenharmony_cisession.connect();
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciprocess.env.TESTVAR = 'foobar';
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_cisession.post('Runtime.evaluate', {
171cb0ef41Sopenharmony_ci  expression: 'process.env.TESTVAR',
181cb0ef41Sopenharmony_ci  throwOnSideEffect: true
191cb0ef41Sopenharmony_ci}, (error, res) => {
201cb0ef41Sopenharmony_ci  assert.ifError(error);
211cb0ef41Sopenharmony_ci  assert.deepStrictEqual(res, {
221cb0ef41Sopenharmony_ci    result: { type: 'string', value: 'foobar' }
231cb0ef41Sopenharmony_ci  });
241cb0ef41Sopenharmony_ci});
25

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