avajs/ava

AVA hangs after all tests pass

rrthomas opened this issue · 2 comments

I have a small project with a simple test suite, with no async code (that I'm aware of, at least!): https://github.com/ursalang/ark

When I run the tests, they all pass, but AVA hangs and runs indefinitely at 100% CPU.

The output looks like this:

  ✔ basics › Concrete values
  ✔ basics › Intrinsics
  ✔ basics › Sequences
  ✔ basics › Conditionals
  ✔ basics › Bare break
  ✔ basics › loop and break
  ✔ basics › let
  ✔ basics › Objects
  ✔ basics › Lists
  ✔ basics › Maps
  ✔ examples › Increment a variable in a loop
  ✔ examples › Sum ints from 1 to 10
  ✔ examples › Call first-class function
  ✔ examples › Factorial (recurse with symbol reference)
  ✔ examples › Factorial (recurse with function argument)
  ✔ examples › Sum list (break result)
  ✔ examples › Sum list (return result)
  ✔ examples › Double list
  ✔ examples › Assign to table
  ✔ examples › Repeated closure
  
  ✘ Timed out while running tests

At the end, AVA is still running.

AVA configuration (from package.json):

"ava": {
    "typescript": {
      "rewritePaths": {
        "src/": "lib/"
      },
      "compile": "tsc"
    }
  },

AVA invocation: npx ava.
AVA version: 5.3.1

Apologies for not providing a minimal example yet; I will endeavour to whittle it down. I note already that even running one of the tests using e.g.

npx ava --match "Lists" src/basics.test.ts

will cause the hang sometimes. The more tests I run, the more often it hangs, it seems. Running one of the two test files:

npx ava src/basics.test.ts

will often but not always hang.

The code being run is entirely deterministic and non-async, so I can't see any reason why I should get different results on different runs.

I tried running the test suite on two different machines "just in case" and got the same symptoms.

Thanks for AVA!

The problem seems to be with worker threads. Works fine if you use the --no-worker-threads flag.

Thanks ever so much for the quick response and workaround. Is there anything else you need me to do here? It sounds as though you're saying it looks like a problem with AVA?