node/test/parallel/test-repl-tab-complete-no-warn.js
Ruben Bridgewater b061a08cab
repl: indicate if errors are thrown or not
Currently an error is printed identical, no matter if it is just
inspected or if the error is thrown inside of the REPL. This makes
sure we are able to distinguish these cases.

PR-URL: https://github.com/nodejs/node/pull/25253
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-05-16 14:56:17 -04:00

23 lines
677 B
JavaScript

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