repl-promise
v0.0.5
Published
An alternative REPL implementation using Promises.
Downloads
6
Readme
repl-promise
A REPL for determinisic processing of input for scripts that use promises.
This REPL implementation is modeled after Node's repl, but unlike several other NPM packages that have been published (see below) which enhance Node's repl in various ways, this implementation is a rewrite from scratch. It was implemented for three reasons:
- Node's repl and readline do not behave deterministically when the input is a file stream. See issue 3628, and in particular the comment just added requesting that the issue be reopened.
- Node's repl is unware of promises. However, this problem is easily addressed using an add-on such as repl-promised.
- As a learning exercise for the author to understand promises and in particular the package Q
This implementation does not use readline and does not provide any of the niceties that one usually expects in a console application for command history, command completion, etc.
Why is it useful then?
See problem #1 above. I'm still searching for a reasonable workaround.
In the meantime, I want to be able to use REPL sessions with input and output to/from file streams in unit tests. I want the output to be appear to be a transcript of a REPL session, so that unit tests result in useful examples.
REPL+Promises alternatives
I've experimented with the following npm packages, none of which currently meet my needs.
- https://www.npmjs.org/package/otaat-repl
- https://www.npmjs.org/package/repl-promised
- https://www.npmjs.org/package/repl.js