• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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([fixtures.path('debugger/empty.js')]);
18
19  function onFatal(error) {
20    cli.quit();
21    throw error;
22  }
23
24  return cli.waitForInitialBreak()
25    .then(() => cli.waitForPrompt())
26    .then(() => cli.command('exec console.profile()'))
27    .then(() => {
28      assert.match(cli.output, /undefined/);
29    })
30    .then(() => cli.command('exec console.profileEnd()'))
31    .then(() => delay(250))
32    .then(() => {
33      assert.match(cli.output, /undefined/);
34      assert.match(cli.output, /Captured new CPU profile\./);
35    })
36    .then(() => cli.quit())
37    .then(null, onFatal);
38}
39