mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
Wait for the WPT child to reach its startup wait before sending Runtime.runIfWaitingForDebugger. Signed-off-by: inoway46 <inoueyuya416@gmail.com> Assisted-by: Codex PR-URL: https://github.com/nodejs/node/pull/65937 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
48 lines
1.4 KiB
JavaScript
48 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const assert = require('assert');
|
|
const path = require('path');
|
|
const { NodeInstance } = require('../common/inspector-helper');
|
|
|
|
const driver = path.join(__dirname, '../wpt/test-compression.js');
|
|
|
|
async function main() {
|
|
const parent = new NodeInstance([], `
|
|
delete process.env.WPT_BACKEND;
|
|
process.env.WPT_INSPECT = '1';
|
|
process.argv[2] = 'compression/compression-bad-chunks.any.html';
|
|
require(${JSON.stringify(driver)});
|
|
`, '', {
|
|
log() {},
|
|
error() {},
|
|
});
|
|
const stderr = [];
|
|
parent.on('stderr', (line) => stderr.push(line));
|
|
|
|
const session = await parent.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.waitForNotification('Debugger.paused');
|
|
await session.send({ method: 'Debugger.resume' });
|
|
await session.disconnect();
|
|
|
|
const { exitCode, signal } = await parent.expectShutdown();
|
|
assert.strictEqual(signal, null);
|
|
assert.strictEqual(exitCode, 0);
|
|
assert.strictEqual(
|
|
stderr.filter((line) => line.startsWith('Debugger listening on ')).length,
|
|
1,
|
|
);
|
|
}
|
|
|
|
main().then(common.mustCall());
|