更新时间:2023-11-17 23:30:58
您可以使用 suppose
包.这就像 Unix Expect.完全公开,我是作者.
You could use the package suppose
. It's like Unix Expect. Full disclosure, I'm the author.
从 Github 页面上的示例,您可以看到它编写 NPM 脚本的示例:https://github.com/jprichardson/节点假设
From the example on the Github page, you can see an example of it scripting NPM: https://github.com/jprichardson/node-suppose
示例:
var suppose = require('suppose')
suppose('script')
.on(/w*/).respond('my data
')
.end(function(code){
console.log('Done: ' + code);
})