Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple project folders in a workspace causes isSpec test to fail #15

Closed
yock opened this issue Jan 28, 2021 · 11 comments · Fixed by #28
Closed

Multiple project folders in a workspace causes isSpec test to fail #15

yock opened this issue Jan 28, 2021 · 11 comments · Fixed by #28
Labels
bug Something isn't working

Comments

@yock
Copy link
Contributor

yock commented Jan 28, 2021

Using the extension in a workspace with multiple project folders, where the invoked spec is not in the first open project, results in an incomplete command being sent to the terminal.

bundle exec rspec --color spec/_spec.rb

The filename string replacement in getAsRelativePath assumes that a single project folder is open in the workspace.

  const rootFile: string = getFilename().replace(vscode.workspace.rootPath, "");

The builtin vscode.workspace.rootPath will always resolve to the first open folder in the workspace. This property is deprecated and VSCode recommends the alternative vscode.workspace.workspaceFolders instead. One possible fix is to iterate over that list until a match is found with the return value of getFilename(). It might also be possible to enhance the isApp, isLib, and isSpec tests to avoid having that dependency.

@fsoikin
Copy link

fsoikin commented Dec 20, 2022

This is still happening for me on 0.5.11.

Ubuntu (in WSL2), project with multiple roots.

@thadeu
Copy link
Owner

thadeu commented Dec 21, 2022

Hey @fsoikin

Can you simulate this for me? In theory, this is happen no more.

@fsoikin
Copy link

fsoikin commented Dec 21, 2022

I'm not sure what "simulate" means in this context, but sure, I can help with debugging. What would you like me to do?

@thadeu
Copy link
Owner

thadeu commented Dec 26, 2022

@fsoikin I would like to know, what exactly happens in these cases. Which scenes? Which name projects? Is file name is the same?

@fsoikin
Copy link

fsoikin commented Dec 27, 2022

I don't quite understand these questions.

  1. What are "scenes"?
  2. What are "projects"?
  3. The file name is the same as what?

I suspect that either by "projects" or "scenes" you may mean VSCode roots. In case that's right - it's a multiroot workspace, and there are two roots in it, one named "rails" and the other named "purs" (though I don't see how the names could be relevant), with the tests located under the "rails" root, in the "spec/" subdirectory.

Here's the terminal log I get when trying to run the "RSpec: Run Line on RSpec" (aka runLineOnRspec) command while having opened file at rails/spec/controllers/auth/requires_hq_login_spec.rb, with caret on line 32:

 λ bundle exec rspec --color spec/_spec.rb:32

An error occurred while loading ./spec/_spec.rb. - Did you mean?
                    rspec ./spec/test_envs_spec.rb

Failure/Error: __send__(method, file)

LoadError:
  cannot load such file -- /home/name/app/rails/spec/_spec.rb
#
# ### <long call stack here> ###
# 
#   Showing full backtrace because every line was filtered out.
#   See docs for RSpec::Configuration#backtrace_exclusion_patterns and
#   RSpec::Configuration#backtrace_inclusion_patterns for more information.
Run options: include {:locations=>{"./spec/_spec.rb"=>[32]}}

All examples were filtered out


Top 0 slowest examples (0 seconds, 0.0% of total time):

Finished in 0.00002 seconds (files took 0.31679 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

As you can see, it did correctly pick up the line, but the file name is, for some reason, spec/_spec.rb, just as in the original description of this issue.

The same log results when trying to "RSpec Run File on RSpec" (aka runFileOnRspec), except without a line number.

@thadeu
Copy link
Owner

thadeu commented Dec 29, 2022

@fsoikin I will going to analyze this scene locally and then go back with new version to fix this.

@thadeu thadeu reopened this Dec 29, 2022
@thadeu thadeu added the bug Something isn't working label Dec 29, 2022
@fsoikin
Copy link

fsoikin commented Dec 29, 2022

Thank you very much @thadeu

@esbanarango
Copy link

I'm also facing this issue 😞

@thadeu
Copy link
Owner

thadeu commented Apr 6, 2023

Sorry folks! I will work to fix this on the weekend, I promise for you.

@ThomasSertorio
Copy link

Same problem here.
Has anyone found a workaround ?

Did you find time to have a look at it @thadeu ?

@thadeu
Copy link
Owner

thadeu commented Sep 15, 2023

@ThomasSertorio Can you could update extension and test again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants