mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 19:49:19 +00:00

Add support for metadata events. At this point they are added to the main buffer. Emit a metadata event for the main thread. PR-URL: https://github.com/nodejs/node/pull/20757 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
28 lines
814 B
JavaScript
28 lines
814 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cp = require('child_process');
|
|
const fs = require('fs');
|
|
|
|
const CODE =
|
|
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
|
const FILE_NAME = 'node_trace.1.log';
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
tmpdir.refresh();
|
|
process.chdir(tmpdir.path);
|
|
|
|
const proc_no_categories = cp.spawn(
|
|
process.execPath,
|
|
[ '--trace-event-categories', '""', '-e', CODE ]
|
|
);
|
|
|
|
proc_no_categories.once('exit', common.mustCall(() => {
|
|
assert(common.fileExists(FILE_NAME));
|
|
// Only __metadata categories should have been emitted.
|
|
fs.readFile(FILE_NAME, common.mustCall((err, data) => {
|
|
assert.ok(JSON.parse(data.toString()).traceEvents.every(
|
|
(trace) => trace.cat === '__metadata'));
|
|
}));
|
|
}));
|