Skip to content

Commit

Permalink
Merge pull request #100 from JordanFaust/fix-breaking-javascript-tree…
Browse files Browse the repository at this point in the history
…sitter-query

fix: fix javascript treesitter queries
  • Loading branch information
rcarriga authored Feb 19, 2024
2 parents c211844 + 6ea51a1 commit 959d45b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lua/neotest-jest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function adapter.discover_positions(path)
; Matches: `describe('context', function() {})`
((call_expression
function: (identifier) @func_name (#eq? @func_name "describe")
arguments: (arguments (string (string_fragment) @namespace.name) (function))
arguments: (arguments (string (string_fragment) @namespace.name) (function_expression))
)) @namespace.definition
; Matches: `describe.only('context', () => {})`
((call_expression
Expand All @@ -176,7 +176,7 @@ function adapter.discover_positions(path)
function: (member_expression
object: (identifier) @func_name (#any-of? @func_name "describe")
)
arguments: (arguments (string (string_fragment) @namespace.name) (function))
arguments: (arguments (string (string_fragment) @namespace.name) (function_expression))
)) @namespace.definition
; Matches: `describe.each(['data'])('context', () => {})`
((call_expression
Expand All @@ -194,21 +194,21 @@ function adapter.discover_positions(path)
object: (identifier) @func_name (#any-of? @func_name "describe")
)
)
arguments: (arguments (string (string_fragment) @namespace.name) (function))
arguments: (arguments (string (string_fragment) @namespace.name) (function_expression))
)) @namespace.definition
; -- Tests --
; Matches: `test('test') / it('test')`
((call_expression
function: (identifier) @func_name (#any-of? @func_name "it" "test")
arguments: (arguments (string (string_fragment) @test.name) [(arrow_function) (function)])
arguments: (arguments (string (string_fragment) @test.name) [(arrow_function) (function_expression)])
)) @test.definition
; Matches: `test.only('test') / it.only('test')`
((call_expression
function: (member_expression
object: (identifier) @func_name (#any-of? @func_name "test" "it")
)
arguments: (arguments (string (string_fragment) @test.name) [(arrow_function) (function)])
arguments: (arguments (string (string_fragment) @test.name) [(arrow_function) (function_expression)])
)) @test.definition
; Matches: `test.each(['data'])('test') / it.each(['data'])('test')`
((call_expression
Expand All @@ -218,7 +218,7 @@ function adapter.discover_positions(path)
property: (property_identifier) @each_property (#eq? @each_property "each")
)
)
arguments: (arguments (string (string_fragment) @test.name) [(arrow_function) (function)])
arguments: (arguments (string (string_fragment) @test.name) [(arrow_function) (function_expression)])
)) @test.definition
]]

Expand Down

0 comments on commit 959d45b

Please sign in to comment.