1'use strict'; 2const common = require('../common'); 3 4common.skipIfInspectorDisabled(); 5 6const fixtures = require('../common/fixtures'); 7const startCLI = require('../common/debugger'); 8 9const assert = require('assert'); 10 11function delay(ms) { 12 return new Promise((resolve) => setTimeout(resolve, ms)); 13} 14 15// Profiles. 16{ 17 const cli = startCLI(['--port=0', fixtures.path('debugger/empty.js')]); 18 19 function onFatal(error) { 20 cli.quit(); 21 throw error; 22 } 23 24 try { 25 (async () => { 26 await cli.waitForInitialBreak(); 27 await cli.waitForPrompt(); 28 await cli.command('exec console.profile()'); 29 assert.match(cli.output, /undefined/); 30 await cli.command('exec console.profileEnd()'); 31 await delay(250); 32 assert.match(cli.output, /undefined/); 33 assert.match(cli.output, /Captured new CPU profile\./); 34 await cli.quit(); 35 })() 36 .then(common.mustCall()); 37 } catch (error) { 38 return onFatal(error); 39 } 40 41} 42