-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb62944
commit e203f49
Showing
2 changed files
with
83 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
local utils = require("neotest-golang.utils") | ||
|
||
local M = {} | ||
|
||
--- Build runspec for a directory. | ||
--- @param pos neotest.Position | ||
--- @param tree neotest.Tree | ||
--- @return neotest.RunSpec | nil | ||
function M.build(pos, tree) | ||
if utils.table_is_empty(tree:children()) then | ||
--- Runspec designed for files that contain no tests. | ||
--- @type neotest.RunSpec | ||
local run_spec = { | ||
command = { "echo", "No tests found in file" }, | ||
context = { | ||
id = pos.id, | ||
skip = true, | ||
test_type = "test", -- TODO: to be implemented as "file" later | ||
}, | ||
} | ||
return run_spec | ||
else | ||
-- TODO: Implement a runspec for a file of tests. | ||
-- A bare return will delegate test execution to per-test execution, which | ||
-- will have to do for now. | ||
return | ||
end | ||
end | ||
|
||
return M |