(replOpts = {})
| 4 | const repl = require('node:repl'); |
| 5 | |
| 6 | function startNewREPLServer(replOpts = {}) { |
| 7 | const input = new ArrayStream(); |
| 8 | const output = new ArrayStream(); |
| 9 | |
| 10 | output.accumulator = ''; |
| 11 | output.write = (data) => (output.accumulator += `${data}`.replaceAll('\r', '')); |
| 12 | |
| 13 | const replServer = repl.start({ |
| 14 | prompt: '', |
| 15 | input, |
| 16 | output, |
| 17 | terminal: true, |
| 18 | allowBlockingCompletions: true, |
| 19 | ...replOpts, |
| 20 | }); |
| 21 | |
| 22 | return { replServer, input, output }; |
| 23 | } |
| 24 | |
| 25 | module.exports = { startNewREPLServer }; |
no test coverage detected
searching dependent graphs…