Open thomthom opened 3 years ago
I ran into this again with another project. I have test helpers that via Rake I'm adding the paths to (task.libs <<
). This works fine via bundle exec rake
from the console, but not via this extension - even though it executes bundle exec rake
.
Am I going against the grain here?
Hey @thomthom!
In my test file I used required_relative "../lib/file.rb"
and it works. From what I dig the problem is that the extension call one rake task defined by it that uses this code that requires the test files from our lib: https://github.com/connorshea/vscode-ruby-test-adapter/blob/main/ruby/vscode/minitest/tests.rb. From my understanding, it's not using/knowing your Rakefile.
If you want to use only require
you need to make sure that something like the following $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
runs during the load of your test files.
I got a Rake task for my tests that looks like this:
I originally configured the test runner as:
But that would not discover, run or debug any tests because the lib paths from the Rake task where not recognized.
I was however able to make it work by adding the lib paths again to each command:
Is this expected? Is there a different way I can set this up that avoids duplicating the paths in multiple places?