mirror of
https://github.com/nodejs/node.git
synced 2025-04-30 07:19:19 +00:00

PR-URL: https://github.com/nodejs/node/pull/25947 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
23 lines
624 B
JavaScript
23 lines
624 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const spawn = require('child_process').spawn;
|
|
|
|
// Spawn a node child process in interactive mode (enabling the REPL) and
|
|
// confirm the '> ' prompt and welcome message is included in the output.
|
|
const cp = spawn(process.execPath, ['-i']);
|
|
|
|
cp.stdout.setEncoding('utf8');
|
|
|
|
let out = '';
|
|
cp.stdout.on('data', (d) => {
|
|
out += d;
|
|
});
|
|
|
|
cp.stdout.on('end', common.mustCall(() => {
|
|
assert.strictEqual(out, `Welcome to Node.js ${process.version}.\n` +
|
|
'Type ".help" for more information.\n> ');
|
|
}));
|
|
|
|
cp.stdin.end('');
|