xref: /third_party/node/test/parallel/test-inspector-vm-global-accessors-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// Regression test for https://github.com/nodejs/node/issues/27518.
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst assert = require('assert');
81cb0ef41Sopenharmony_ciconst inspector = require('inspector');
91cb0ef41Sopenharmony_ciconst vm = require('vm');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciconst session = new inspector.Session();
121cb0ef41Sopenharmony_cisession.connect();
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciconst context = vm.createContext({
151cb0ef41Sopenharmony_ci  a: 100
161cb0ef41Sopenharmony_ci});
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_cisession.post('Runtime.evaluate', {
191cb0ef41Sopenharmony_ci  expression: 'a',
201cb0ef41Sopenharmony_ci  throwOnSideEffect: true,
211cb0ef41Sopenharmony_ci  contextId: 2 // context's id
221cb0ef41Sopenharmony_ci}, common.mustSucceed((res) => {
231cb0ef41Sopenharmony_ci  assert.deepStrictEqual(res, {
241cb0ef41Sopenharmony_ci    result: {
251cb0ef41Sopenharmony_ci      type: 'number',
261cb0ef41Sopenharmony_ci      value: context.a,
271cb0ef41Sopenharmony_ci      description: '100'
281cb0ef41Sopenharmony_ci    }
291cb0ef41Sopenharmony_ci  });
301cb0ef41Sopenharmony_ci}));
31

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