mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
PR-URL: https://github.com/nodejs/node/pull/59964 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
34 lines
952 B
JavaScript
34 lines
952 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
const assert = require('assert');
|
|
const { startNewREPLServer } = require('../common/repl');
|
|
|
|
if (process.env.TERM === 'dumb') {
|
|
common.skip('skipping - dumb terminal');
|
|
}
|
|
|
|
const command = `.load ${fixtures.path('repl-load-multiline-no-trailing-newline.js')}`;
|
|
const terminalCode = '\u001b[1G\u001b[0J \u001b[1G';
|
|
const terminalCodeRegex = new RegExp(terminalCode.replace(/\[/g, '\\['), 'g');
|
|
|
|
const expected = `${command}
|
|
// The lack of a newline at the end of this file is intentional.
|
|
const getLunch = () =>
|
|
placeOrder('tacos')
|
|
.then(eat);
|
|
|
|
const placeOrder = (order) => Promise.resolve(order);
|
|
const eat = (food) => '<nom nom nom>';
|
|
undefined
|
|
`;
|
|
|
|
const { replServer, output } = startNewREPLServer();
|
|
|
|
replServer.write(`${command}\n`);
|
|
assert.strictEqual(
|
|
output.accumulator.replace(terminalCodeRegex, ''),
|
|
expected
|
|
);
|
|
replServer.close();
|