failing async test ends in timeout instead of go to catch clause
sombriks opened this issue · 0 comments
sombriks commented
I have some async tests and everything goes ok except when i get some assertion failing.
This is very similar to the issue described here.
For example, the bellow snippet dies in timeout because the content-type is different to the expected:
import test from 'ava'
import request from 'supertest'
import { app, database } from './main.js'
// other tests
test('should get htmx browser script', async t => {
try {
const result = await request(app.callback()).get('/htmx.js')
t.regex(result.header["content-type"], /javascript/)
t.is(200, result.status)
} catch (e) {
t.fail(e.message)
}
})
But first i got the timeout and only then i get the message regarding the failing regex match:
Any guidance on how to avoid timeout is welcome. The sample code, ava version and everything else is in this repo.