1'use strict'; 2 3// Test --cpu-prof without --cpu-prof-interval. Here we just verify that 4// we manage to generate a profile since it's hard to tell whether we 5// can sample our target function with the default sampling rate across 6// different platforms and machine configurations. 7 8const common = require('../common'); 9const fixtures = require('../common/fixtures'); 10common.skipIfInspectorDisabled(); 11 12const assert = require('assert'); 13const { spawnSync } = require('child_process'); 14 15const tmpdir = require('../common/tmpdir'); 16const { 17 getCpuProfiles, 18 env 19} = require('../common/cpu-prof'); 20 21{ 22 tmpdir.refresh(); 23 const output = spawnSync(process.execPath, [ 24 '--cpu-prof', 25 fixtures.path('workload', 'fibonacci.js'), 26 ], { 27 cwd: tmpdir.path, 28 env 29 }); 30 if (output.status !== 0) { 31 console.log(output.stderr.toString()); 32 } 33 assert.strictEqual(output.status, 0); 34 const profiles = getCpuProfiles(tmpdir.path); 35 assert.strictEqual(profiles.length, 1); 36} 37