avajs/ava

Ava skips next tests in file if a previous test timeouts

emilis-ideait opened this issue · 1 comments

Minimal reproducible example

In our test suite we have multiple test(...) tests per file. We are using Selenium to drive a browser in these tests.

Sometimes a test runs longer than the specified timeout.

I noticed that in such case all the remaining tests in the file will be skipped and a "X tests were pending in example-file.js" message will be printed to output.

I expected only the slow test to timeout and the remaining tests to run.

ava.config.js:

export default {
    concurrency:            1,
    files: [
        'test-a.test.js',
        'test-b.test.js',
    ],
    serial:                 true,
    timeout:                '2s',
    verbose:                true,
};

Same happens with both Ava 4.2.0 and 5.1.1.

AVA's timeout detection works by tracking how long it's been since there was last an "event" coming out of a test worker. If that takes too long, the worker is stopped.

Your setup executes tests serially, so subsequent tests are not run.

I think if you'd use t.timeout() within the test, then that specific test would time out but the rest would continue running.