Skip to content

Commit

Permalink
test: deflake test-esm-loader-hooks-inspect-brk
Browse files Browse the repository at this point in the history
Refs: nodejs#54827
Refs: nodejs#51560
PR-URL: nodejs#56050
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
lpinca authored Dec 19, 2024
1 parent 854d23b commit 990497c
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions test/parallel/test-esm-loader-hooks-inspect-brk.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,20 @@ const assert = require('assert');
const fixtures = require('../common/fixtures');
const { NodeInstance } = require('../common/inspector-helper.js');

async function runIfWaitingForDebugger(session) {
const commands = [
{ 'method': 'Runtime.enable' },
{ 'method': 'Debugger.enable' },
{ 'method': 'Runtime.runIfWaitingForDebugger' },
];

await session.send(commands);
await session.waitForNotification('Debugger.paused');
}

async function runTest() {
const main = fixtures.path('es-module-loaders', 'register-loader.mjs');
const child = new NodeInstance(['--inspect-brk=0'], '', main);

const session = await child.connectInspectorSession();
await runIfWaitingForDebugger(session);
await session.send({ method: 'NodeRuntime.enable' });
await session.waitForNotification('NodeRuntime.waitingForDebugger');
await session.send([
{ 'method': 'Runtime.enable' },
{ 'method': 'Debugger.enable' },
{ 'method': 'Runtime.runIfWaitingForDebugger' },
]);
await session.send({ method: 'NodeRuntime.disable' });
await session.waitForNotification('Debugger.paused');
await session.runToCompletion();
assert.strictEqual((await child.expectShutdown()).exitCode, 0);
}
Expand Down

0 comments on commit 990497c

Please sign in to comment.