Skip to content

Commit 60f5f54

Browse files
lpincatargos
authored andcommittedOct 2, 2024
test: reduce test-esm-loader-hooks-inspect-wait flakiness
Refs: #51560 PR-URL: #54827 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f5e7738 commit 60f5f54

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed
 

‎test/parallel/test-esm-loader-hooks-inspect-wait.js

+8-11
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,19 @@ const assert = require('assert');
1010
const fixtures = require('../common/fixtures');
1111
const { NodeInstance } = require('../common/inspector-helper.js');
1212

13-
async function runIfWaitingForDebugger(session) {
14-
const commands = [
15-
{ 'method': 'Runtime.enable' },
16-
{ 'method': 'Debugger.enable' },
17-
{ 'method': 'Runtime.runIfWaitingForDebugger' },
18-
];
19-
20-
await session.send(commands);
21-
}
22-
2313
async function runTest() {
2414
const main = fixtures.path('es-module-loaders', 'register-loader.mjs');
2515
const child = new NodeInstance(['--inspect-wait=0'], '', main);
2616

2717
const session = await child.connectInspectorSession();
28-
await runIfWaitingForDebugger(session);
18+
await session.send({ method: 'NodeRuntime.enable' });
19+
await session.waitForNotification('NodeRuntime.waitingForDebugger');
20+
await session.send([
21+
{ 'method': 'Runtime.enable' },
22+
{ 'method': 'Debugger.enable' },
23+
{ 'method': 'Runtime.runIfWaitingForDebugger' },
24+
]);
25+
await session.send({ method: 'NodeRuntime.disable' });
2926
await session.waitForDisconnect();
3027
assert.strictEqual((await child.expectShutdown()).exitCode, 0);
3128
}

0 commit comments

Comments
 (0)
Please sign in to comment.