Open rubaiz opened 4 years ago
The previous test runs probably need to be killed when a new one gets started, to prevent multiple test reloads from occurring in parallel. And potentially we should also debounce these test suite reloads, e.g. only try to reload the test suites after 10 seconds of inactivity or something.
So I didn't run a single test within VSCode. I just edited an RSpec file and at some point I'm seeing many rspec processes spawned by vscode-ruby-test-adapter
and although it's not quite visible here, it's eating my whole CPU power.
It's also doing some database preparations in parallel.
I asked at vscode-test-explorer
how I can see whether autorun is activated since I suspected this feature to be the reason for it but I don't see the little play icon.
Do you have any hint what could be the cause of this?
I'm having the same issue. Every time I make a change and save a test, the entire test suite refreshes. Every time I hit save, another refresh queues up. Fans start running, the computer slows down. If I hit save 3 times, the entire suite refreshes 3 times.
It's tough to stop the muscle memory to save after each change I make. But only when I'm working on tests.
Your environment
vscode-ruby-test-adapter
version: 0.7.1Expected behavior
The tests should not continuously reload while editing a test file. Or the reload needs to be super fast.
Actual behavior
The list of tests is continuously reloaded while editing a test file (even when Autorun is disabled). The reload is slow and causes high CPU usage.
Every time a *test.rb file is saved the plugin triggers an autorun event (see log below) and lists the tests. Since i have auto save enabled, this triggers a new run every few seconds while editing / fixing tests. These saves end up triggering multiple "Getting a list of Minitest tests in suite.." events. Which get queued up and cause high CPU load for an extended period of time.
Example Ruby Test Explorer log with just a few seconds of file edits triggering multiple runs:
[2020-06-16 22:10:36.450] [INFO] /Users/path/to/some_test.rb was saved - checking if this effects /Users/path/to/rails/project [2020-06-16 22:10:36.450] [INFO] A test file has been edited, reloading tests. [2020-06-16 22:10:36.450] [INFO] Loading Ruby tests... [2020-06-16 22:10:36.450] [INFO] Loading Minitest tests... [2020-06-16 22:10:36.450] [INFO] Getting a list of Minitest tests in suite with the following command: bundle exec rake -R $EXT_DIR vscode:minitest:list [2020-06-16 22:10:36.457] [INFO] Sending autorun event [2020-06-16 22:10:38.451] [INFO] /Users/path/to/some_test.rb was saved - checking if this effects /Users/path/to/rails/project [2020-06-16 22:10:38.452] [INFO] A test file has been edited, reloading tests. [2020-06-16 22:10:38.452] [INFO] Loading Ruby tests... [2020-06-16 22:10:38.452] [INFO] Loading Minitest tests... [2020-06-16 22:10:38.452] [INFO] Getting a list of Minitest tests in suite with the following command: bundle exec rake -R $EXT_DIR vscode:minitest:list [2020-06-16 22:10:38.457] [INFO] Sending autorun event [2020-06-16 22:10:40.058] [INFO] /Users/path/to/some_test.rb was saved - checking if this effects /Users/path/to/rails/project [2020-06-16 22:10:40.058] [INFO] A test file has been edited, reloading tests. [2020-06-16 22:10:40.058] [INFO] Loading Ruby tests... [2020-06-16 22:10:40.058] [INFO] Loading Minitest tests... [2020-06-16 22:10:40.059] [INFO] Getting a list of Minitest tests in suite with the following command: bundle exec rake -R $EXT_DIR vscode:minitest:list [2020-06-16 22:10:40.064] [INFO] Sending autorun event [2020-06-16 22:10:45.598] [INFO] /Users/path/to/some_test.rb was saved - checking if this effects /Users/path/to/rails/project [2020-06-16 22:10:45.598] [INFO] A test file has been edited, reloading tests. [2020-06-16 22:10:45.598] [INFO] Loading Ruby tests... [2020-06-16 22:10:45.598] [INFO] Loading Minitest tests... [2020-06-16 22:10:45.598] [INFO] Getting a list of Minitest tests in suite with the following command: bundle exec rake -R $EXT_DIR vscode:minitest:list [2020-06-16 22:10:45.607] [INFO] Sending autorun event [2020-06-16 22:10:48.158] [INFO] /Users/path/to/some_test.rb was saved - checking if this effects /Users/path/to/rails/project [2020-06-16 22:10:48.158] [INFO] A test file has been edited, reloading tests. [2020-06-16 22:10:48.158] [INFO] Loading Ruby tests... [2020-06-16 22:10:48.158] [INFO] Loading Minitest tests... [2020-06-16 22:10:48.158] [INFO] Getting a list of Minitest tests in suite with the following command: bundle exec rake -R $EXT_DIR vscode:minitest:list [2020-06-16 22:10:48.165] [INFO] Sending autorun event