Skip to content

Commit

Permalink
test: reduce test-esm-loader-hooks-inspect-wait flakiness
Browse files Browse the repository at this point in the history
Refs: nodejs#51560
PR-URL: nodejs#54827
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
lpinca authored and louwers committed Nov 2, 2024
1 parent bbc442b commit 9d23914
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions test/parallel/test-esm-loader-hooks-inspect-wait.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@ 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);
}

async function runTest() {
const main = fixtures.path('es-module-loaders', 'register-loader.mjs');
const child = new NodeInstance(['--inspect-wait=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.waitForDisconnect();
assert.strictEqual((await child.expectShutdown()).exitCode, 0);
}
Expand Down

0 comments on commit 9d23914

Please sign in to comment.