Allow to run dynamic TypeScript and JavaScript tests (#31499)
First of all thank you for such a fast editor! I realized that the existing support for detecting runnable test cases for typescript/javascript is not full. Meanwhile I can run most of test by pressing "run button": <img width="713" alt="image" src="https://github.com/user-attachments/assets/e8bb1cb1-f0a5-4eb1-b9a6-7188a9fa47ae" /> I can't run dynamic tests: <img width="703" alt="image" src="https://github.com/user-attachments/assets/d7eef1bc-e99a-4f05-9d62-ec49b8194959" /> I was curious whether I can improve it on my own and created this pr. I edited schemas and added minor changes in `TaskTemplate` to allow to replace '%s' with regexp pattern, so it can match test cases: <img width="772" alt="image" src="https://github.com/user-attachments/assets/db3a6fe0-ad90-4853-8e98-4215e41dfe88" /> Release Notes: - Allow to run dynamic TypeScript/JavaScript tests --------- Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
parent
79e7ccc1fe
commit
6fe58a2c4e
5 changed files with 106 additions and 5 deletions
|
@ -80,4 +80,21 @@
|
|||
)
|
||||
) @item
|
||||
|
||||
; Add support for parameterized tests
|
||||
(
|
||||
(call_expression
|
||||
function: (call_expression
|
||||
function: (member_expression
|
||||
object: [(identifier) @_name (member_expression object: (identifier) @_name)]
|
||||
property: (property_identifier) @_property
|
||||
)
|
||||
(#any-of? @_name "it" "test" "describe" "context" "suite")
|
||||
(#eq? @_property "each")
|
||||
)
|
||||
arguments: (
|
||||
arguments . (string (string_fragment) @name)
|
||||
)
|
||||
)
|
||||
) @item
|
||||
|
||||
(comment) @annotation
|
||||
|
|
|
@ -19,3 +19,22 @@
|
|||
|
||||
(#set! tag js-test)
|
||||
)
|
||||
|
||||
; Add support for parameterized tests
|
||||
(
|
||||
(call_expression
|
||||
function: (call_expression
|
||||
function: (member_expression
|
||||
object: [(identifier) @_name (member_expression object: (identifier) @_name)]
|
||||
property: (property_identifier) @_property
|
||||
)
|
||||
(#any-of? @_name "it" "test" "describe" "context" "suite")
|
||||
(#eq? @_property "each")
|
||||
)
|
||||
arguments: (
|
||||
arguments . (string (string_fragment) @run)
|
||||
)
|
||||
) @_js-test
|
||||
|
||||
(#set! tag js-test)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue