node/deps/node-inspect/test/cli/profile.test.js
Jan Krems 85f54908bf
deps: add node-inspect 1.10.2
Squashed from:

- deps: Add node-inspect 1.10.1

This adds a reimplementation of the old CLI debugger (`node debug`)
against the new debugger protocol (`node --inspect`). This is necessary
because the old protocol won't be supported in future versions of V8.

- deps: Update node-inspect to 1.10.2

Starting with 1.10.2 the test suite should pass consistently on
windows.

- deps: Update to node-inspect 1.10.4

PR-URL: https://github.com/nodejs/node/pull/10187
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-14 11:52:37 -05:00

32 lines
766 B
JavaScript

'use strict';
const { test } = require('tap');
const startCLI = require('./start-cli');
function delay(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
test('profiles', (t) => {
const cli = startCLI(['examples/empty.js']);
function onFatal(error) {
cli.quit();
throw error;
}
return cli.waitFor(/break/)
.then(() => cli.waitForPrompt())
.then(() => cli.command('exec console.profile()'))
.then(() => {
t.match(cli.output, 'undefined');
})
.then(() => cli.command('exec console.profileEnd()'))
.then(() => delay(250))
.then(() => {
t.match(cli.output, 'undefined');
t.match(cli.output, 'Captured new CPU profile.');
})
.then(() => cli.quit())
.then(null, onFatal);
});