11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst { Worker } = require('worker_threads'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled(); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciif (!process.env.HAS_STARTED_WORKER) { 91cb0ef41Sopenharmony_ci process.env.HAS_STARTED_WORKER = 1; 101cb0ef41Sopenharmony_ci new Worker(__filename); 111cb0ef41Sopenharmony_ci return; 121cb0ef41Sopenharmony_ci} 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciconst assert = require('assert'); 151cb0ef41Sopenharmony_ciconst { Session } = require('inspector'); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciconst session = new Session(); 181cb0ef41Sopenharmony_cisession.connect(); 191cb0ef41Sopenharmony_cisession.post('NodeTracing.start', { 201cb0ef41Sopenharmony_ci traceConfig: { includedCategories: ['node.perf'] } 211cb0ef41Sopenharmony_ci}, common.mustCall((err) => { 221cb0ef41Sopenharmony_ci assert.deepStrictEqual(err, { 231cb0ef41Sopenharmony_ci code: -32000, 241cb0ef41Sopenharmony_ci message: 251cb0ef41Sopenharmony_ci 'Tracing properties can only be changed through main thread sessions' 261cb0ef41Sopenharmony_ci }); 271cb0ef41Sopenharmony_ci})); 281cb0ef41Sopenharmony_cisession.disconnect(); 29