1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const spawn = require('child_process').spawn; 5 6// Spawn a node child process in interactive mode (enabling the REPL) and 7// confirm the '> ' prompt and welcome message is included in the output. 8const cp = spawn(process.execPath, ['-i']); 9 10cp.stdout.setEncoding('utf8'); 11 12let out = ''; 13cp.stdout.on('data', (d) => { 14 out += d; 15}); 16 17cp.stdout.on('end', common.mustCall(() => { 18 assert.strictEqual(out, `Welcome to Node.js ${process.version}.\n` + 19 'Type ".help" for more information.\n> '); 20})); 21 22cp.stdin.end(''); 23