Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-debugger-profile.js « sequential « test - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bf4a69720022cd4c60d37192d9ea0b11630346c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'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);
  }

}