Closed
Description
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? :)