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