Trace Events JS API doesn't work w/o CLI args

  • Version: 10.9+, 11+
  • Platform: macOS, Ubuntu
  • Subsystem: trace_events

The Trace Events JS API isn't functional if none of --trace-events-enabled or --trace-event-categories is passed as a CLI argument. In other words, traces are never written when this program is run without command line arguments:

const trace_events = require('trace_events');
const tracing = trace_events.createTracing({ categories: ['v8', 'node', 'node.perf', 'node.async_hooks'] });
tracing.enable();
tracing.disable();

In Node 10.8 in earlier this code works as intended, and a trace file is created.