
Hi, this pull request superseeds the https://github.com/zed-industries/zed/pull/12624 and removes queries for runnables from `outline.scm`. This pull request has couple things to mention: - Removed task for running tests with `minitest` as I think it's not reliable in its state because, AFAIK, the only way to run `minitest` with the specific line, i.e. `bundle exec rake test spec/models/some_model.rb:12` is to use it with Rails. The support for `minitest` is still there and users can add their own task, for instance, when they use `minitest` in Rails to get support for running tests: ```json { "label": "test $ZED_RELATIVE_FILE:$ZED_ROW", "command": "./bin/rails", "args": ["test", "\"$ZED_RELATIVE_FILE:$ZED_ROW\""], "tags": ["minitest-test"] } ``` **Question:** Perhaps that should be mentioned in the Ruby extension documentation? - Adjusted runnables queries to work without `ZED_SYMBOL`. Release Notes: - N/A
60 lines
1.6 KiB
Scheme
60 lines
1.6 KiB
Scheme
; Adapted from the following sources:
|
|
; Minitest: https://github.com/zidhuss/neotest-minitest/blob/main/lua/neotest-minitest/init.lua
|
|
; RSpec: https://github.com/olimorris/neotest-rspec/blob/main/lua/neotest-rspec/init.lua
|
|
|
|
; Minitest
|
|
;; Rails unit tests
|
|
(
|
|
(class
|
|
name: [
|
|
(constant) @run
|
|
(scope_resolution scope: (constant) name: (constant) @run)
|
|
]
|
|
(superclass (scope_resolution) @superclass (#match? @superclass "(::IntegrationTest|::TestCase|::SystemTestCase|Minitest::Test)$"))
|
|
) @_minitest-test
|
|
(#set! tag minitest-test)
|
|
)
|
|
|
|
(
|
|
(call
|
|
method: (identifier) @run (#eq? @run "test")
|
|
arguments: (argument_list (string (string_content) @_name))
|
|
) @_minitest-test
|
|
(#set! tag minitest-test)
|
|
)
|
|
|
|
; Methods that begin with test_
|
|
(
|
|
(method
|
|
name: (identifier) @run (#match? @run "^test_")
|
|
) @_minitest-test
|
|
(#set! tag minitest-test)
|
|
)
|
|
|
|
; System tests that inherit from ApplicationSystemTestCase
|
|
(
|
|
(class
|
|
name: (constant) @run (superclass) @superclass (#match? @superclass "(ApplicationSystemTestCase)$")
|
|
) @_minitest-test
|
|
(#set! tag minitest-test)
|
|
)
|
|
|
|
; RSpec
|
|
; Examples
|
|
(
|
|
(call
|
|
method: (identifier) @run (#any-of? @run "describe" "context" "it" "its" "specify")
|
|
arguments: (argument_list . (_) @_name)
|
|
) @_rspec-test
|
|
(#set! tag rspec-test)
|
|
)
|
|
|
|
; Examples (one-liner syntax)
|
|
(
|
|
(call
|
|
method: (identifier) @run (#any-of? @run "it" "its" "specify")
|
|
block: (_) @_name
|
|
!arguments
|
|
) @_rspec-test
|
|
(#set! tag rspec-test)
|
|
)
|