mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
feat: jest support for tsx (#47)
This commit is contained in:
parent
7f09d0d003
commit
2b71abbcc3
3 changed files with 152 additions and 0 deletions
|
@ -34,3 +34,38 @@
|
|||
value: (_) @var_type) @type
|
||||
(#set! "kind" "Variable")
|
||||
) @start
|
||||
|
||||
; describe("Unit test")
|
||||
(call_expression
|
||||
function: (identifier) @method @name (#any-of? @method "describe" "it" "test" "afterAll" "afterEach" "beforeAll" "beforeEach")
|
||||
arguments: (arguments
|
||||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
|
||||
; test.skip("this test")
|
||||
(call_expression
|
||||
function: (member_expression
|
||||
object: (identifier) @method (#any-of? @method "describe" "it" "test")
|
||||
property: (property_identifier) @modifier (#any-of? @modifier "skip" "todo")
|
||||
) @name
|
||||
arguments: (arguments
|
||||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
|
||||
; describe.each([])("Test suite")
|
||||
(call_expression
|
||||
function: (call_expression
|
||||
function: (member_expression
|
||||
object: (identifier) @method (#any-of? @method "describe" "it" "test")
|
||||
property: (property_identifier) @modifier (#any-of? @modifier "each")
|
||||
) @name
|
||||
)
|
||||
arguments: (arguments
|
||||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
|
|
|
@ -86,6 +86,109 @@ describe("treesitter tsx", function()
|
|||
end_lnum = 18,
|
||||
end_col = 22,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "describe UnitTest",
|
||||
level = 0,
|
||||
lnum = 20,
|
||||
col = 0,
|
||||
end_lnum = 32,
|
||||
end_col = 2,
|
||||
children = {
|
||||
{
|
||||
kind = "Function",
|
||||
name = "afterAll",
|
||||
level = 1,
|
||||
lnum = 21,
|
||||
col = 2,
|
||||
end_lnum = 21,
|
||||
end_col = 20,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "afterEach",
|
||||
level = 1,
|
||||
lnum = 22,
|
||||
col = 2,
|
||||
end_lnum = 22,
|
||||
end_col = 21,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "beforeAll",
|
||||
level = 1,
|
||||
lnum = 23,
|
||||
col = 2,
|
||||
end_lnum = 23,
|
||||
end_col = 21,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "beforeEach",
|
||||
level = 1,
|
||||
lnum = 24,
|
||||
col = 2,
|
||||
end_lnum = 24,
|
||||
end_col = 22,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "test should describe the test",
|
||||
level = 1,
|
||||
lnum = 25,
|
||||
col = 2,
|
||||
end_lnum = 25,
|
||||
end_col = 44,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "it is an alias for test",
|
||||
level = 1,
|
||||
lnum = 26,
|
||||
col = 2,
|
||||
end_lnum = 26,
|
||||
end_col = 38,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "test.skip skip this test",
|
||||
level = 1,
|
||||
lnum = 27,
|
||||
col = 2,
|
||||
end_lnum = 27,
|
||||
end_col = 39,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "test.todo this is a todo",
|
||||
level = 1,
|
||||
lnum = 28,
|
||||
col = 2,
|
||||
end_lnum = 28,
|
||||
end_col = 29,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "describe.each Test Suite",
|
||||
level = 1,
|
||||
lnum = 29,
|
||||
col = 2,
|
||||
end_lnum = 31,
|
||||
end_col = 4,
|
||||
children = {
|
||||
{
|
||||
kind = "Function",
|
||||
name = "test.each runs multiple times",
|
||||
level = 2,
|
||||
lnum = 30,
|
||||
col = 4,
|
||||
end_lnum = 30,
|
||||
end_col = 50,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end)
|
||||
end)
|
||||
|
|
|
@ -16,3 +16,17 @@ const fn_3 = () => {};
|
|||
|
||||
const const_var = 'value';
|
||||
let let_var = 'value';
|
||||
|
||||
describe("UnitTest", () => {
|
||||
afterAll(() => {});
|
||||
afterEach(() => {});
|
||||
beforeAll(() => {});
|
||||
beforeEach(() => {});
|
||||
test("should describe the test", () => {});
|
||||
it("is an alias for test", () => {});
|
||||
test.skip("skip this test", () => {});
|
||||
test.todo("this is a todo");
|
||||
describe.each([])("Test Suite", () => {
|
||||
test.each([])("runs multiple times", () => {});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue