• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const { Worker } = require('worker_threads');
5
6common.skipIfInspectorDisabled();
7
8if (!process.env.HAS_STARTED_WORKER) {
9  process.env.HAS_STARTED_WORKER = 1;
10  new Worker(__filename);
11  return;
12}
13
14const assert = require('assert');
15const { Session } = require('inspector');
16
17const session = new Session();
18session.connect();
19session.post('NodeTracing.start', {
20  traceConfig: { includedCategories: ['node.perf'] }
21}, common.mustCall((err) => {
22  assert.deepStrictEqual(err, {
23    code: -32000,
24    message:
25      'Tracing properties can only be changed through main thread sessions'
26  });
27}));
28session.disconnect();
29