I am running unit test using mocha, I want to forcefully timeout, if the function exceeds 30000, so I have set this.timeout(30000);
to verify its working I put infinite loop inside test case, even timeout exceeds test doesn't return back. I want this test to stop executing after timeout.
Here is the test
it('should forcefully timeout',function(done) {
this.timeout(30000);
while(1) {
for(var i = 0; i < 10000; i++) {
if( i % 2 == 0 ) {
console.log("here");
for(var i=0; i < 10000; i++) {
if( i % 2 == 0 ) {
console.log("here1");
}
}
}
}
}
done();
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.