ExUnit: How to find your synchronous test suites
I had an ExUnit run output on Elixir 1.12 that listed out the async test times and the sync test times. I wanted to find which test suites that were sync, but the project was too large to spot check every single suite.
I couldn’t find an ExUnit option that would list that information and I dug through the ExUnit source code to see if there was some undocumented feature. No luck. What I did find was that in the ExUnit.Server module, there are these add methods for sync and async tests:
So I thought of using trusty RexBug to trace that module to see if the add_sync_module method was being called at all.
I added Rexbug.start("ExUnit.Server.add_sync_module/_")
at the top of my test_helper.exs file and then ran mix test
.
It worked!! During my test run, I saw the following calls:
All that was left was going to those suites and adding async: true
.