From 6ba782610d1f30efbeaf603e3d5cd0039ea0f902 Mon Sep 17 00:00:00 2001 From: V13Axel Date: Tue, 11 Jun 2024 11:02:08 -0400 Subject: [PATCH] Update tests of the plugin itself --- lua/neotest-pest/init.lua | 10 +++++++++- scripts/test | 3 ++- specs/minimal_init.vim | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/neotest-pest/init.lua b/lua/neotest-pest/init.lua index 0aaf7ee..488aed6 100644 --- a/lua/neotest-pest/init.lua +++ b/lua/neotest-pest/init.lua @@ -82,8 +82,16 @@ function NeotestAdapter.discover_positions(path) ((function_call_expression function: (name) @func_name (#match? @func_name "^(test|it)$") - arguments: (arguments . (argument (string (string_content) @test.name))) + arguments: (arguments . (argument (_ (string_content) @test.name))) )) @test.definition + + ((expression_statement + (member_call_expression + object: (#eq? @test.definition) + name: (name) @member_call_name (#match? @member_call_name "^(with)$") + arguments: (arguments . (argument (array_creation_expression (array_element_initializer (array_creation_expression (array_element_initializer (_) @test.parameter .) ))))) + ) + )) ]] return lib.treesitter.parse_positions(path, query, { diff --git a/scripts/test b/scripts/test index b55c643..d33cd3b 100755 --- a/scripts/test +++ b/scripts/test @@ -2,13 +2,14 @@ tempfile=".test_output.tmp" # Create packpath directory -mkdir -p packpath +mkdir -p packpath/pack/manual/opt # Need to clone these plugins to run tests: git -C packpath/pack/manual/opt/plenary.nvim pull || git clone https://github.com/nvim-lua/plenary.nvim.git ./packpath/pack/manual/opt/plenary.nvim git -C packpath/pack/manual/opt/neotest pull || git clone https://github.com/nvim-neotest/neotest.git ./packpath/pack/manual/opt/neotest git -C packpath/pack/manual/opt/neotest-plenary pull || git clone https://github.com/nvim-neotest/neotest-plenary.git ./packpath/pack/manual/opt/neotest-plenary git -C packpath/pack/manual/opt/nvim-treesitter pull || git clone https://github.com/nvim-treesitter/nvim-treesitter.git ./packpath/pack/manual/opt/nvim-treesitter +git -C packpath/pack/manual/opt/nvim-nio pull || git clone https://github.com/nvim-neotest/nvim-nio.git ./packpath/pack/manual/opt/nvim-nio # Run tests if [[ -n $1 ]]; then diff --git a/specs/minimal_init.vim b/specs/minimal_init.vim index 7bdb966..18506da 100644 --- a/specs/minimal_init.vim +++ b/specs/minimal_init.vim @@ -4,4 +4,5 @@ set rtp+=./packpath/plenary.nvim packadd! plenary.nvim packadd! neotest packadd! neotest-plenary +packadd! nvim-nio runtime! plugin/plenary.vim