Replies: 1 comment 2 replies
-
Hey great to hear you want to write an adapter! 😄 Unless I'm misunderstanding, this should be relatively simple since it's just a single node and neotest doesn't require that you have children in the file. Something like this should be sufficient local lib = require("neotest.lib")
local Tree = require("neotest.types").Tree
local Adapter = {}
---@param file_path string Absolute file path
---@return neotest.Tree | nil
function Adapter.discover_positions(file_path)
local sep = lib.files.sep
local path_elems = vim.split(file_path, sep, { plain = true })
return Tree.from_list({
{
type = "file",
path = file_path,
name = path_elems[#path_elems],
},
})
end Though I might be missing something as I haven't tested. Let me know if you have any issues! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I was considering writing an adapter for CodeQL tests. Theses tests are defined in an non-standard way though, there are multiple directories and each of them contains a
.ql
or.qlref
file which contains the query to run as a test. So each file is itself a single query. Considering that neotests expects a file to be parsed to extract namespaces and tests from it, would it fit this other way of defining tests? What shouldAdapter.discover_positions(path)
return? We cant use treesitter here since.qlref
files just contain the location of a query to be run as part of a test. Can we build aNeotest.Tree
with a single node as if there was a single position in each test file? Any adapters working in a similar way that I could use as a reference?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions