mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 13:28:42 +00:00

Make changes so that tests will pass when the comma-dangle settings applied to the rest of the code base are also applied to tests. PR-URL: https://github.com/nodejs/node/pull/37930 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cp = require('child_process');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
const names = [
|
|
'environment',
|
|
'nodeStart',
|
|
'v8Start',
|
|
'loopStart',
|
|
'loopExit',
|
|
'bootstrapComplete',
|
|
];
|
|
|
|
if (process.argv[2] === 'child') {
|
|
1 + 1; // eslint-disable-line no-unused-expressions
|
|
} else {
|
|
tmpdir.refresh();
|
|
|
|
const proc = cp.fork(__filename,
|
|
[ 'child' ], {
|
|
cwd: tmpdir.path,
|
|
execArgv: [
|
|
'--trace-event-categories',
|
|
'node.bootstrap',
|
|
]
|
|
});
|
|
|
|
proc.once('exit', common.mustCall(() => {
|
|
const file = path.join(tmpdir.path, 'node_trace.1.log');
|
|
|
|
assert(fs.existsSync(file));
|
|
fs.readFile(file, common.mustCall((err, data) => {
|
|
const traces = JSON.parse(data.toString()).traceEvents
|
|
.filter((trace) => trace.cat !== '__metadata');
|
|
traces.forEach((trace) => {
|
|
assert.strictEqual(trace.pid, proc.pid);
|
|
assert(names.includes(trace.name));
|
|
});
|
|
}));
|
|
}));
|
|
}
|