1'use strict'; 2const common = require('../common'); 3 4process.env.TERM = 'dumb'; 5 6const repl = require('repl'); 7const ArrayStream = require('../common/arraystream'); 8 9repl.start('> '); 10process.stdin.push('conso'); // No completion preview. 11process.stdin.push('le.log("foo")\n'); 12process.stdin.push('1 + 2'); // No input preview. 13process.stdin.push('\n'); 14process.stdin.push('"str"\n'); 15process.stdin.push('console.dir({ a: 1 })\n'); 16process.stdin.push('{ a: 1 }\n'); 17process.stdin.push('\n'); 18process.stdin.push('.exit\n'); 19 20// Verify <ctrl> + D support. 21{ 22 const stream = new ArrayStream(); 23 const replServer = new repl.REPLServer({ 24 prompt: '> ', 25 terminal: true, 26 input: stream, 27 output: process.stdout, 28 useColors: false 29 }); 30 31 replServer.on('close', common.mustCall()); 32 // Verify that <ctrl> + R or <ctrl> + C does not trigger the reverse search. 33 replServer.write(null, { ctrl: true, name: 'r' }); 34 replServer.write(null, { ctrl: true, name: 's' }); 35 replServer.write(null, { ctrl: true, name: 'd' }); 36} 37