Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lua/neotest/client/runner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ function TestRunner:_run_tree(tree, args, adapter_id, adapter, results_callback)
end
local async_runners = {}
for _, spec in ipairs(specs) do
if not (type(spec.strategy) == "function" or type(spec.strategy) == "table" or spec.strategy == nil) then
self:_run_broken_down_tree(tree, args, adapter_id, adapter, results_callback)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just raise the error directly here, it's not clear that this is being called just to raise an error

return
end

table.insert(async_runners, function()
self:_run_spec(spec, tree, args, adapter_id, adapter, results_callback)
end)
Expand Down
9 changes: 5 additions & 4 deletions lua/neotest/client/strategies/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ function ProcessTracker:run(pos_id, spec, args, stream_processor, context)
self._process_semaphore.with(function()
instance = strategy(spec, context)
if not instance then
lib.notify("Adapter doesn't support chosen strategy.", vim.log.levels.ERROR)
local output_path = nio.fn.tempname()
assert(io.open(output_path, "w")):close()
return { code = 1, output = output_path }
return
end
self._instances[pos_id] = instance
if stream_processor then
Expand All @@ -53,6 +50,10 @@ function ProcessTracker:run(pos_id, spec, args, stream_processor, context)
end
code = instance.result()
end)
if not instance then
error("Adapter doesn't provide a correct strategy")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the original wording of the error

end

logger.info("Process for position", pos_id, "exited with code", code)
local output = instance.output()
logger.debug("Output of process ", output)
Expand Down