-
Notifications
You must be signed in to change notification settings - Fork 225
Don't generate test code lenses when the test library is not supported #769
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -43,6 +43,42 @@ def test_bar; end | |||||||||
| ) | ||||||||||
| end | ||||||||||
|
|
||||||||||
| def test_no_code_lens_for_unknown_test_framework | ||||||||||
| source = <<~RUBY | ||||||||||
| class FooTest < Test::Unit::TestCase | ||||||||||
| def test_bar; end | ||||||||||
| end | ||||||||||
| RUBY | ||||||||||
| uri = "file:///fake.rb" | ||||||||||
|
|
||||||||||
| document = RubyLsp::Document.new(source: source, version: 1, uri: uri) | ||||||||||
|
|
||||||||||
| emitter = RubyLsp::EventEmitter.new | ||||||||||
| listener = RubyLsp::Requests::CodeLens.new(uri, emitter, @message_queue, "unknown") | ||||||||||
| emitter.visit(document.tree) | ||||||||||
| response = listener.response | ||||||||||
|
|
||||||||||
| assert_equal(0, response.size) | ||||||||||
|
Comment on lines
+59
to
+61
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| end | ||||||||||
|
|
||||||||||
| def test_no_code_lens_for_rspec | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this test verify any behaviour that the |
||||||||||
| source = <<~RUBY | ||||||||||
| class FooTest < Test::Unit::TestCase | ||||||||||
| def test_bar; end | ||||||||||
| end | ||||||||||
| RUBY | ||||||||||
| uri = "file:///fake.rb" | ||||||||||
|
|
||||||||||
| document = RubyLsp::Document.new(source: source, version: 1, uri: uri) | ||||||||||
|
|
||||||||||
| emitter = RubyLsp::EventEmitter.new | ||||||||||
| listener = RubyLsp::Requests::CodeLens.new(uri, emitter, @message_queue, "rspec") | ||||||||||
| emitter.visit(document.tree) | ||||||||||
| response = listener.response | ||||||||||
|
|
||||||||||
| assert_equal(0, response.size) | ||||||||||
|
Comment on lines
+77
to
+79
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| end | ||||||||||
|
|
||||||||||
| def test_after_request_hook | ||||||||||
| message_queue = Thread::Queue.new | ||||||||||
| create_code_lens_hook_class | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an idea: if we split test code lens listeners into 2, like
TestCodeLensandBundlerCodeLens, we can skip registering events inTestCodeLensif the test library is not supported. I think this will save us some unnecessary computation.If it's preferred, now could be a good time for this before we ship
ruby-lsp-rails' code lens support.WDYT? @vinistock @andyw8
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not critical for now though, we can bump the
ruby-lsp-railsdependency later if we refactor things.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think splitting is worth the complexity yet.