Apply TypeScript test improvements to tsx files (#32477)
relates-to: #32467 relates-to: #31499 Release Notes: - N/A
This commit is contained in:
parent
027ce6889c
commit
83eb6ffe1e
2 changed files with 50 additions and 2 deletions
|
@ -83,7 +83,30 @@
|
||||||
] @context
|
] @context
|
||||||
(#any-of? @_name "it" "test" "describe" "context" "suite")
|
(#any-of? @_name "it" "test" "describe" "context" "suite")
|
||||||
arguments: (
|
arguments: (
|
||||||
arguments . (string (string_fragment) @name)
|
arguments . [
|
||||||
|
(string (string_fragment) @name)
|
||||||
|
(identifier) @name
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) @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")
|
||||||
|
(#any-of? @_property "each")
|
||||||
|
)
|
||||||
|
arguments: (
|
||||||
|
arguments . [
|
||||||
|
(string (string_fragment) @name)
|
||||||
|
(identifier) @name
|
||||||
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) @item
|
) @item
|
||||||
|
|
|
@ -13,7 +13,32 @@
|
||||||
]
|
]
|
||||||
(#any-of? @_name "it" "test" "describe" "context" "suite")
|
(#any-of? @_name "it" "test" "describe" "context" "suite")
|
||||||
arguments: (
|
arguments: (
|
||||||
arguments . (string (string_fragment) @run)
|
arguments . [
|
||||||
|
(string (string_fragment) @run)
|
||||||
|
(identifier) @run
|
||||||
|
]
|
||||||
|
)
|
||||||
|
) @_js-test
|
||||||
|
|
||||||
|
(#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")
|
||||||
|
(#any-of? @_property "each")
|
||||||
|
)
|
||||||
|
arguments: (
|
||||||
|
arguments . [
|
||||||
|
(string (string_fragment) @run)
|
||||||
|
(identifier) @run
|
||||||
|
]
|
||||||
)
|
)
|
||||||
) @_js-test
|
) @_js-test
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue