mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
It should remove both the error and the ready event listeners attached when either of them fires, instead of removing only the one whose corresponding event fires, otherwise the other event listener will always get leaked. PR-URL: https://github.com/nodejs/node/pull/60464 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
40 lines
985 B
JavaScript
40 lines
985 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const assert = require('assert');
|
|
|
|
const RESTARTS = 10;
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
const startCLI = require('../common/debugger');
|
|
|
|
// Using `restart` should result in only one "Connect/For help" message.
|
|
{
|
|
const script = fixtures.path('debugger', 'three-lines.js');
|
|
const cli = startCLI([script]);
|
|
|
|
const listeningRegExp = /Debugger listening on/g;
|
|
|
|
async function onWaitForInitialBreak() {
|
|
try {
|
|
await cli.waitForInitialBreak();
|
|
await cli.waitForPrompt();
|
|
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
|
|
|
|
for (let i = 0; i < RESTARTS; i++) {
|
|
await cli.stepCommand('restart');
|
|
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
|
|
}
|
|
} finally {
|
|
await cli.quit();
|
|
}
|
|
|
|
assert.doesNotMatch(cli.stderrOutput, /MaxListenersExceededWarning/);
|
|
}
|
|
|
|
onWaitForInitialBreak();
|
|
}
|