node/test/parallel/test-repl-tab-complete-getter-error.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

37 lines
831 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const { startNewREPLServer } = require('../common/repl');
(async function() {
await runTest();
})().then(common.mustCall());
async function runTest() {
const { replServer } = startNewREPLServer();
await new Promise((resolve, reject) => {
replServer.eval(`
const foo = { get name() { throw new Error(); } };
`, replServer.context, '', (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
['foo.name.', 'foo["name"].'].forEach((test) => {
replServer.complete(
test,
common.mustCall((error, data) => {
assert.strictEqual(error, null);
assert.strictEqual(data.length, 2);
assert.strictEqual(data[1], test);
})
);
});
}