(inputStr, replOptions)
| 13 | // Processes some input in a REPL instance and returns a promise that |
| 14 | // resolves to the produced output (as a string). |
| 15 | function 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 | |
| 36 | describe('with previews', () => { |
| 37 | it("doesn't show previews by default", async () => { |
no test coverage detected
searching dependent graphs…