Skip to content

using setInterval() globally blocks the tests execution #3352

@futin

Description

@futin

Hello,

I was trying to migrate from ava@5.1.1 to ava@6.2.0 when I found that only 1 file was processed, and the execution was stuck until the timeout. Below is the config from package.json:

{
"ava": {
    "concurrency": 1,
    "timeout": "5m",
    "files": [
      "test/unit/**/*.spec.js" (here I have over 10 files)
    ],
    "failFast": false,
    "verbose": true
  }

After a couple of hours of debugging, I found out that simple usage of setInterval blocks the whole process, and I would like to know what can cause this behavior, as it does not seem expected (especially because the whole execution is blocked, apparently without reason).

How to reproduce it?

Add this code in any testing directory, as a separate file:

import test from 'ava'
setInterval(() => {}, x) // x can be any value, I used 60 * 60 * 1000, so the code within the `setInterval` was never even executed.

test('simple test', async t => {
  t.pass()
})

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions