node/test/parallel/test-repl-tab-complete-no-warn.js
Dario Piotrowicz 9ac571d0d5
test: add new startNewREPLSever testing utility
PR-URL: https://github.com/nodejs/node/pull/59964
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2025-09-30 15:20:02 +02:00

18 lines
572 B
JavaScript

'use strict';
const common = require('../common');
const { startNewREPLServer } = require('../common/repl');
const DEFAULT_MAX_LISTENERS = require('events').defaultMaxListeners;
const { replServer, input } = startNewREPLServer();
// https://github.com/nodejs/node/issues/18284
// Tab-completion should not repeatedly add the
// `Runtime.executionContextCreated` listener
process.on('warning', common.mustNotCall());
input.run(['async function test() {']);
for (let i = 0; i < DEFAULT_MAX_LISTENERS; i++) {
replServer.complete('await Promise.resolve()', () => {});
}