mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 15:35:41 +00:00

Read-only access to `process.env` does not have side effects. Refs: https://github.com/nodejs/node/pull/27523 PR-URL: https://github.com/nodejs/node/pull/27684 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Aleksei Koziatinskii <ak239spb@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
32 lines
674 B
JavaScript
32 lines
674 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
// Regression test for https://github.com/nodejs/node/issues/27518.
|
|
|
|
const assert = require('assert');
|
|
const inspector = require('inspector');
|
|
const vm = require('vm');
|
|
|
|
const session = new inspector.Session();
|
|
session.connect();
|
|
|
|
const context = vm.createContext({
|
|
a: 100
|
|
});
|
|
|
|
session.post('Runtime.evaluate', {
|
|
expression: 'a',
|
|
throwOnSideEffect: true,
|
|
contextId: 2 // context's id
|
|
}, common.mustCall((error, res) => {
|
|
assert.ifError(error),
|
|
assert.deepStrictEqual(res, {
|
|
result: {
|
|
type: 'number',
|
|
value: context.a,
|
|
description: '100'
|
|
}
|
|
});
|
|
}));
|