mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: reduce test-esm-loader-hooks-inspect-wait flakiness
Refs: https://github.com/nodejs/node/pull/51560 PR-URL: https://github.com/nodejs/node/pull/54827 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
4b2cab29a5
commit
e48df8d64b
@ -10,22 +10,19 @@ const assert = require('assert');
|
|||||||
const fixtures = require('../common/fixtures');
|
const fixtures = require('../common/fixtures');
|
||||||
const { NodeInstance } = require('../common/inspector-helper.js');
|
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() {
|
async function runTest() {
|
||||||
const main = fixtures.path('es-module-loaders', 'register-loader.mjs');
|
const main = fixtures.path('es-module-loaders', 'register-loader.mjs');
|
||||||
const child = new NodeInstance(['--inspect-wait=0'], '', main);
|
const child = new NodeInstance(['--inspect-wait=0'], '', main);
|
||||||
|
|
||||||
const session = await child.connectInspectorSession();
|
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();
|
await session.waitForDisconnect();
|
||||||
assert.strictEqual((await child.expectShutdown()).exitCode, 0);
|
assert.strictEqual((await child.expectShutdown()).exitCode, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user