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

Function getReplRunOutput

test/parallel/test-repl-custom-eval-previews.js:15–34  ·  view source on GitHub ↗
(inputStr, replOptions)

Source from the content-addressed store, hash-verified

13// Processes some input in a REPL instance and returns a promise that
14// resolves to the produced output (as a string).
15function getReplRunOutput(inputStr, replOptions) {
16 return new Promise((resolve) => {
17 const { replServer, input, output } = startNewREPLServer({ prompt: testingReplPrompt, ...replOptions });
18
19 output.accumulator = '';
20
21 output.write = (chunk) => {
22 output.accumulator += chunk;
23 // The prompt appears after the input has been processed
24 if (output.accumulator.includes(testingReplPrompt)) {
25 replServer.close();
26 resolve(output.accumulator);
27 }
28 };
29
30 input.emit('data', inputStr);
31
32 input.run(['']);
33 });
34}
35
36describe('with previews', () => {
37 it("doesn't show previews by default", async () => {

Calls 6

startNewREPLServerFunction · 0.85
includesMethod · 0.80
closeMethod · 0.65
resolveFunction · 0.50
emitMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…