xref: /third_party/node/test/parallel/test-trace-events-process-exit.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst cp = require('child_process');
51cb0ef41Sopenharmony_ciconst fs = require('fs');
61cb0ef41Sopenharmony_ciconst path = require('path');
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir');
91cb0ef41Sopenharmony_citmpdir.refresh();
101cb0ef41Sopenharmony_ciconst FILE_NAME = path.join(tmpdir.path, 'node_trace.1.log');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconst proc = cp.spawn(process.execPath,
131cb0ef41Sopenharmony_ci                      [ '--trace-events-enabled',
141cb0ef41Sopenharmony_ci                        '-e', 'process.exit()' ],
151cb0ef41Sopenharmony_ci                      { cwd: tmpdir.path });
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciproc.once('exit', common.mustCall(() => {
181cb0ef41Sopenharmony_ci  assert(fs.existsSync(FILE_NAME));
191cb0ef41Sopenharmony_ci  fs.readFile(FILE_NAME, common.mustCall((err, data) => {
201cb0ef41Sopenharmony_ci    const traces = JSON.parse(data.toString()).traceEvents;
211cb0ef41Sopenharmony_ci    assert(traces.length > 0);
221cb0ef41Sopenharmony_ci  }));
231cb0ef41Sopenharmony_ci}));
24

Indexes created Thu Nov 07 10:32:03 CST 2024