2017-07-17 14:51:26 +00:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
common.skipIf32Bits();
|
2017-10-14 02:42:38 +00:00
|
|
|
const { NodeInstance } = require('../common/inspector-helper.js');
|
2017-07-17 14:51:26 +00:00
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
const script = `
|
|
|
|
setTimeout(() => {
|
|
|
|
debugger;
|
|
|
|
process.exitCode = 55;
|
|
|
|
}, 50);
|
|
|
|
`;
|
|
|
|
|
2017-08-01 22:28:51 +00:00
|
|
|
async function skipBreakpointAtStart(session) {
|
2019-01-30 22:13:45 +00:00
|
|
|
await session.waitForBreakOnLine(1, '[eval]');
|
2017-08-01 22:28:51 +00:00
|
|
|
await session.send({ 'method': 'Debugger.resume' });
|
|
|
|
}
|
|
|
|
|
2017-07-17 14:51:26 +00:00
|
|
|
async function checkAsyncStackTrace(session) {
|
|
|
|
console.error('[test]', 'Verify basic properties of asyncStackTrace');
|
2019-01-30 22:13:45 +00:00
|
|
|
const paused = await session.waitForBreakOnLine(2, '[eval]');
|
2017-07-17 14:51:26 +00:00
|
|
|
assert(paused.params.asyncStackTrace,
|
|
|
|
`${Object.keys(paused.params)} contains "asyncStackTrace" property`);
|
|
|
|
assert(paused.params.asyncStackTrace.description, 'Timeout');
|
|
|
|
assert(paused.params.asyncStackTrace.callFrames
|
2020-10-04 08:26:20 +00:00
|
|
|
.some((frame) => frame.url === 'node:internal/process/execution'));
|
2017-07-17 14:51:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async function runTests() {
|
|
|
|
const instance = new NodeInstance(undefined, script);
|
|
|
|
const session = await instance.connectInspectorSession();
|
2024-02-23 22:46:29 +00:00
|
|
|
await session.send({ method: 'NodeRuntime.enable' });
|
|
|
|
await session.waitForNotification('NodeRuntime.waitingForDebugger');
|
2017-07-17 14:51:26 +00:00
|
|
|
await session.send([
|
|
|
|
{ 'method': 'Runtime.enable' },
|
|
|
|
{ 'method': 'Debugger.enable' },
|
|
|
|
{ 'method': 'Debugger.setAsyncCallStackDepth',
|
|
|
|
'params': { 'maxDepth': 10 } },
|
|
|
|
{ 'method': 'Debugger.setBlackboxPatterns',
|
|
|
|
'params': { 'patterns': [] } },
|
2021-03-26 15:51:08 +00:00
|
|
|
{ 'method': 'Runtime.runIfWaitingForDebugger' },
|
2017-07-17 14:51:26 +00:00
|
|
|
]);
|
2024-02-23 22:46:29 +00:00
|
|
|
await session.send({ method: 'NodeRuntime.disable' });
|
2017-08-01 22:28:51 +00:00
|
|
|
await skipBreakpointAtStart(session);
|
2017-07-17 14:51:26 +00:00
|
|
|
await checkAsyncStackTrace(session);
|
|
|
|
|
|
|
|
await session.runToCompletion();
|
2018-10-12 17:24:33 +00:00
|
|
|
assert.strictEqual((await instance.expectShutdown()).exitCode, 55);
|
2017-07-17 14:51:26 +00:00
|
|
|
}
|
|
|
|
|
2020-04-05 20:27:46 +00:00
|
|
|
runTests().then(common.mustCall());
|