I want to test a CLI app and want to receive user input while the test is running, since mocha.js has 200ms limit the test is failing. So I want to know how to halt the test while the script is getting input and resume after getting it.
You can increase test timeouts like so;
describe('increased timeout', function(){
it('should not timeout', function(done){
this.timeout(2000);
setTimout(done, 1500);
});
});
But I don't recommend you do this. You can use nexpect or stream-expect to simulate user input. This way you can write alot of automated tests.
Example usage of stream-expect
You should make your test async. Add done
argument and invoke it when you done.
http://visionmedia.github.io/mocha/ - check Asynchronous code section for samples.