blob: 9f164ee62797205f527b1a57a28ea44219ea58b0 (
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
|
'use strict';
const common = require('../common');
const assert = require('assert');
const cp = require('child_process');
const fs = require('fs');
const tmpdir = require('../common/tmpdir');
const FILE_NAME = 'node_trace.1.log';
tmpdir.refresh();
process.chdir(tmpdir.path);
const proc = cp.spawn(process.execPath,
[ '--trace-events-enabled',
'-e', 'process.exit()' ]);
proc.once('exit', common.mustCall(() => {
assert(common.fileExists(FILE_NAME));
fs.readFile(FILE_NAME, common.mustCall((err, data) => {
const traces = JSON.parse(data.toString()).traceEvents;
assert(traces.length > 0);
}));
}));
|