MCPcopy Index your code
hub / github.com/nodejs/node / run

Function run

test/parallel/test-repl-editor.js:17–41  ·  view source on GitHub ↗
({ input: inputStr, output: outputStr, event, checkTerminalCodes = true })

Source from the content-addressed store, hash-verified

15const terminalCodeRegex = new RegExp(terminalCode.replace(/\[/g, '\\['), 'g');
16
17function run({ input: inputStr, output: outputStr, event, checkTerminalCodes = true }) {
18 let expected =
19 `${terminalCode}.editor\n` +
20 '// Entering editor mode (Ctrl+D to finish, Ctrl+C to cancel)\n' +
21 `${inputStr}${outputStr}\n${terminalCode}`;
22
23 const { replServer, input, output } = startNewREPLServer({
24 prompt: '> ',
25 terminal: true,
26 useColors: false
27 });
28
29 input.emit('data', '.editor\n');
30 input.emit('data', inputStr);
31 replServer.write('', event);
32 replServer.close();
33
34 let found = output.accumulator;
35 if (!checkTerminalCodes) {
36 found = found.replace(terminalCodeRegex, '').replace(/\n/g, '');
37 expected = expected.replace(terminalCodeRegex, '').replace(/\n/g, '');
38 }
39
40 assert.strictEqual(found, expected);
41}
42
43const tests = [
44 {

Calls 4

startNewREPLServerFunction · 0.85
closeMethod · 0.65
emitMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected