用mocha.jstestingCLI应用程序
我想testingCLI应用程序,并希望在testing运行时接收用户input,因为mocha.js具有200ms限制testing失败。 所以我想知道如何在脚本获得input时暂停testing,并在获得input后恢复。
你可以像这样增加testing超时
describe('increased timeout', function(){ it('should not timeout', function(done){ this.timeout(2000); setTimout(done, 1500); }); });
但我不build议你这样做。 您可以使用nexpect或stream – 期望模拟用户input。 这样你可以写很多自动化testing。
stream-expect的示例用法
你应该做你的testingasynchronous。 添加done
参数并在完成后调用它。 http://visionmedia.github.io/mocha/ – 检查示例的asynchronous代码部分。
- aws-sdk s3上传不工作从摩卡testing
- 使用dynamodb在本地testingnodejs aws lambda
- 尝试在摩卡中使用asynchronous/等待
- 如何以编程方式closuresExpressJS的实例进行testing?
- require.main.require工作,但不在摩卡testing
- Node.js – 简单的Restify POST摩卡testing失败
- 从callback中返回一个值,或者在node.js中的特定callback之外访问它?
- 摩卡返回“callback不是一个函数”asynchronous调用
- 使用mocha-phantomjs来自动化functiontesting