mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 05:30:00 +00:00

This fixes a regression introduced in https://github.com/nodejs/node/pull/6171 PR-URL: https://github.com/nodejs/node/pull/11871 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
30 lines
689 B
JavaScript
30 lines
689 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const repl = require('repl');
|
|
|
|
{
|
|
let evalCalledWithExpectedArgs = false;
|
|
|
|
const options = {
|
|
eval: common.mustCall((cmd, context) => {
|
|
// Assertions here will not cause the test to exit with an error code
|
|
// so set a boolean that is checked in process.on('exit',...) instead.
|
|
evalCalledWithExpectedArgs = (cmd === '\n');
|
|
})
|
|
};
|
|
|
|
const r = repl.start(options);
|
|
|
|
try {
|
|
// Empty strings should be sent to the repl's eval function
|
|
r.write('\n');
|
|
} finally {
|
|
r.write('.exit\n');
|
|
}
|
|
|
|
process.on('exit', () => {
|
|
assert(evalCalledWithExpectedArgs);
|
|
});
|
|
}
|