summaryrefslogtreecommitdiff
path: root/test/parallel/test-trace-events-dynamic-enable-workers-disabled.js
blob: 634017f95ad051f0b45150c26d2032e0b43ea9a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict';

const common = require('../common');
const { Worker } = require('worker_threads');

common.skipIfInspectorDisabled();

if (!process.env.HAS_STARTED_WORKER) {
  process.env.HAS_STARTED_WORKER = 1;
  new Worker(__filename);
  return;
}

const assert = require('assert');
const { Session } = require('inspector');

const session = new Session();
session.connect();
session.post('NodeTracing.start', {
  traceConfig: { includedCategories: ['node.perf'] }
}, common.mustCall((err) => {
  assert.deepStrictEqual(err, {
    code: -32000,
    message:
      'Tracing properties can only be changed through main thread sessions'
  });
}));
session.disconnect();