ava: Add idle timeout support
Just switched to AVA – and I love it! – but, – and this is really a minor issue – I also noticed that I kept reusing code like this:
import test from 'ava';
function failAfter(time, t){
setTimeout(() => {
t.fail('timed out after ' + time + ' ms');
t.end(); /* fail fast! */
}, time);
}
async function thisShouldntTakeLong(){ /* or does it? >_< */
return new Promise(resolve => setTimeout(resolve, 9999));
}
test('this shouldnt take long', async t => {
failAfter(1000, t);
await thisShouldntTakeLong();
});
And just to be clear, I don’t like global test timeouts – I think they’re a terrible idea.
Yet again, I think something like t.failAfter(time)
is not too bad.
What do you guys think? 😃
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 39 (31 by maintainers)
I am lost – what is the current accepted way to set timeout per test? Is it:
?
Still interested!