xref: /third_party/node/test/parallel/test-inspector-enabled.js (revision 1cb0ef41)
  • 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_ciconst spawn = require('child_process').spawn;
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst script = `
81cb0ef41Sopenharmony_ciconst assert = require('assert');
91cb0ef41Sopenharmony_ciconst inspector = process.binding('inspector');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciassert(
121cb0ef41Sopenharmony_ci  !!inspector.isEnabled(),
131cb0ef41Sopenharmony_ci  'inspector.isEnabled() should be true when run with --inspect');
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciprocess._debugEnd();
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciassert(
181cb0ef41Sopenharmony_ci  !inspector.isEnabled(),
191cb0ef41Sopenharmony_ci  'inspector.isEnabled() should be false after _debugEnd()');
201cb0ef41Sopenharmony_ci`;
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ciconst args = ['--inspect=0', '-e', script];
231cb0ef41Sopenharmony_ciconst child = spawn(process.execPath, args, {
241cb0ef41Sopenharmony_ci  stdio: 'inherit',
251cb0ef41Sopenharmony_ci  env: { ...process.env, NODE_V8_COVERAGE: '' }
261cb0ef41Sopenharmony_ci});
271cb0ef41Sopenharmony_cichild.on('exit', (code, signal) => {
281cb0ef41Sopenharmony_ci  process.exit(code || signal);
291cb0ef41Sopenharmony_ci});
30

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