node/test/parallel/test-esm-loader-hooks-inspect-wait.js
Joyee Cheung 558a5743c6
test: add more logs to test-esm-loader-hooks-inspect-wait
This provides a bit more information about where & when the child
processes crashes when it crashes / flakes in the CI.

PR-URL: https://github.com/nodejs/node/pull/60466
Refs: https://github.com/nodejs/node/issues/54346
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2026-02-24 00:36:30 +01:00

35 lines
1.1 KiB
JavaScript

// This tests esm loader's internal worker will not be blocked by --inspect-wait.
// Regression: https://github.com/nodejs/node/issues/53681
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const assert = require('assert');
const fixtures = require('../common/fixtures');
const { NodeInstance } = require('../common/inspector-helper.js');
async function runTest() {
const main = fixtures.path('es-module-loaders', 'register-loader.mjs');
process.env.NODE_DEBUG = 'esm,async_loader_worker';
const child = new NodeInstance(['--inspect-wait=0'], '', main);
const session = await child.connectInspectorSession();
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();
const result = await child.expectShutdown();
assert.deepStrictEqual(result, {
exitCode: 0,
signal: null,
});
}
runTest();