VS Code + ElixirLS + test = slow

Am I missing something or is running tests in VS Code’s Test explore tab far slower than when running mix test?

Looking at the test running output it appears to be running each test separately.

(video is stopped after 8 seconds but the full test run would take 90 seconds)

Video of output showing difference in speed <0.5 sec (mix test) vs 90 seconds (VS Code + ElixirLS)

I’m experiencing the same exact same thing, and I haven’t found a way to fix it either. My current workaround is to use Elixir Test - Visual Studio Marketplace

That way I get access to two new commands that I use regularly called “Run all tests on file” and “Run test at cursor”.

It’s not quite as nice as the VSCode test runner. You can’t debug a test using VSCode breakpoints for example. However, it works quite well to run the tests in the current file you’re working on for example, and then just use the (slow) VSCode test runner if you need to deep dive into why a specific test fails.

2 Likes

Thanks for the confirmation and the reference to the Elixir Test extension. Work around works fine for me. Just wanted to confirm I wasn’t missing something.

2 Likes

That’s a known issue and it’s tracked in Test UI runs each test separately · Issue #306 · elixir-lsp/vscode-elixir-ls · GitHub. Elixir does not have a good API for streaming test results in realtime

2 Likes

Thanks for confirming (and for your work on ElixirLS). I can easily work around and it’s good to know I’m not missing something obvious.