Have you ever heard of the command line program expect? Basically,
allows you to automate command line programs.
suppose is a programmable
Node.js module that allows the same behavior.
From the expect wikipedia page, you can see many examples of
scripts automating tasks such as
ftp sessions. Now you can easily
write Node.js scripts to do the same. This may be most beneficial during testing.
npm install suppose
Automate the command
npm init, which initializes a new npm module.
var suppose =fs =assert =process;fs// debug is an optional writeable output stream// response can also be the second argument to .when
.respond() may be called any number of times after
.when(). Each response
will be sent in the order defined when the condition matches. Once all
conditions and responses are defined, call
.end() to begin execution.
Copyright 2012-2013, JP Richardson