mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
PR-URL: https://github.com/nodejs/node/pull/44684 Reviewed-By: Rich Trott <rtrott@gmail.com>
42 lines
948 B
JavaScript
42 lines
948 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
const startCLI = require('../common/debugger');
|
|
|
|
const assert = require('assert');
|
|
|
|
function delay(ms) {
|
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
}
|
|
|
|
// Profiles.
|
|
{
|
|
const cli = startCLI([fixtures.path('debugger/empty.js')]);
|
|
|
|
function onFatal(error) {
|
|
cli.quit();
|
|
throw error;
|
|
}
|
|
|
|
try {
|
|
(async () => {
|
|
await cli.waitForInitialBreak();
|
|
await cli.waitForPrompt();
|
|
await cli.command('exec console.profile()');
|
|
assert.match(cli.output, /undefined/);
|
|
await cli.command('exec console.profileEnd()');
|
|
await delay(250);
|
|
assert.match(cli.output, /undefined/);
|
|
assert.match(cli.output, /Captured new CPU profile\./);
|
|
await cli.quit();
|
|
})()
|
|
.then(common.mustCall());
|
|
} catch (error) {
|
|
return onFatal(error);
|
|
}
|
|
|
|
}
|