-
Notifications
You must be signed in to change notification settings - Fork 25
Add @RUBY_TEST_NAME capture for test nodes
#97
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
Conversation
Reordered and added @RUBY_TEST_NAME capture to test method arguments and blocks to provide explicit test name references for: - test method with string argument - describe/context/it/its/specify methods with arguments - it/its/specify methods with blocks without arguments
|
👋 @vitallium is this still working for you with example in the PR description? I'm trying to update my config to use the new I'm on the latest Zed (v0.188.5) and I'm using a local check out of this repo. |
Hi! We haven't released a new version with that fix yet. I think we can do that now. Let me create a new release. Thanks! |
Yeah, I realised that but I was using 'Install Dev Extension' to run it locally. Just tried with the v0.8.0 release and I'm seeing the same problem. |
Ah, found the problem. It is a result of bad merge: diff --git i/languages/ruby/runnables.scm w/languages/ruby/runnables.scm
index c58344a..2bda1fb 100644
--- i/languages/ruby/runnables.scm
+++ w/languages/ruby/runnables.scm
@@ -17,8 +17,8 @@
(
(call
method: (identifier) @run (#eq? @run "test")
- ) @_ruby-test
arguments: (argument_list (string (string_content) @name @RUBY_TEST_NAME))
+ ) @_ruby-test
(#set! tag ruby-test)
)
@@ -42,8 +42,8 @@
(
(call
method: (identifier) @run (#any-of? @run "describe" "context" "it" "its" "specify")
- ) @_ruby-test
arguments: (argument_list . (_) @name @RUBY_TEST_NAME)
+ ) @_ruby-test
(#set! tag ruby-test)
)I think I should prioritize #95 to avoid such annoying issues. I will push a fix and release v0.8.1. Sorry for that! |
|
Pushed the fix. |
|
Thanks for looking into. Still doesn't seem to work for me though 🤔 Are you on the same Zed version? (v0.188.5) |
|
This is now working for me, but I think there may be some issue with how tasks are cached in Zed. I'll report if I notice it again. |
Awesome. Thanks! |
|
Hey @vitallium ! Thank you for this lovely extension. I've just started using Zed with ruby, and I have encountered a problem with Here is an example file: class TestApp < Minitest::Test
def test_root_endpoint
get "/"
assert last_response.ok?
assert_equal "application/json", last_response.content_type
end
endIf I try to spawn a test within Here are my tasks definitions: [
{
"label": "Test /$ZED_CUSTOM_RUBY_TEST_NAME/",
"command": "bundle",
"args": [
"exec",
"ruby",
"-Itest",
"-rhelper",
"$ZED_RELATIVE_FILE",
"-n",
"\"$ZED_CUSTOM_RUBY_TEST_NAME\""
],
"tags": ["ruby-test"]
}
]I would appreciate any pointers. Thanks again! |
Hi, it seems we don't expose |

Reordered and added
@RUBY_TEST_NAMEcapture to test method arguments and blocks to provide explicit test name references for:This capture can be references in Zed tasks via
ZED_CUSTOM_RUBY_TEST_NAMEvariable. For example, to run a single Minitest properly we need to define the following Zed task:{ "label": "test $ZED_RELATIVE_FILE -n /$ZED_CUSTOM_RUBY_TEST_NAME/", "command": "bin/rails", "args": [ "test", "$ZED_RELATIVE_FILE", "-n", "/$ZED_CUSTOM_RUBY_TEST_NAME/" ], "tags": ["ruby-test"] }