Open sidlatau opened 1 year ago
Haven't had a chance to install flutter and test but my initial thought is that the debugger doesn't emit an exited
event which is used to collect the exit code. Can you verify?
https://github.com/nvim-neotest/neotest/blob/392808a91d6ee28d27cbfb93c9fd9781759b5d00/lua/neotest/client/strategies/dap/init.lua#L47-L52
I added logging:
before = function(config)
dap.listeners.after.event_output[handler_id] = function(_, body)
vim.pretty_print("output-------", body)
if vim.tbl_contains({ "stdout", "stderr" }, body.category) then
async.run(function()
data_accum:push(body.output)
end)
end
end
dap.listeners.after.event_exited[handler_id] = function(_, info)
vim.pretty_print("exit----------", info)
result_code = info.exitCode
async.run(function()
pcall(finish_cond.notify_all, finish_cond)
end)
end
return adapter_before and adapter_before() or config
end,
after = function()
vim.pretty_print("after----------")
dap.listeners.after.event_output[handler_id] = nil
if adapter_after then
adapter_after()
end
end,
Here is the output:
"output-------" {
category = "stdout",
output = "\n"
}
"output-------" {
category = "console",
output = "Connecting to VM Service at ws://127.0.0.1:57252/cyQJoBnVwn0=/ws\n"
}
"output-------" {
category = "console",
output = '✓ Help page press "send device data" tile - confirmation dialog shown\n'
}
"output-------" {
output = "\nExited."
}
"after----------"
So yes, there is no exited
event emitted. But I see after
callback is called - maybe at that point we can somehow indicate, that test finished?
I've handled an exit event not being emitted and defaulted the exit code to 0, so it'll be up to the adapter to handle no exit code which I imagine is relatively easy if not already handled.
NeoVim Version Output of
nvim --version
Describe the bug I run flutter test with DAP configuration. Test starts, I am able to stop on the breakpoint, bet when continuing (or not adding any breakpoint) test visually never stops - I always see "in progress" icon both in
signcolumn
and inneotest
summary window.To Reproduce Please provide a minimal
init.lua
to reproduce which can be run as the following:minimal.lua
```lua -- ignore default config and plugins vim.opt.runtimepath:remove(vim.fn.expand("~/.config/nvim")) vim.opt.packpath:remove(vim.fn.expand("~/.local/share/nvim/site")) vim.opt.termguicolors = true -- append test directory local test_dir = "/tmp/nvim-config" vim.opt.runtimepath:append(vim.fn.expand(test_dir)) vim.opt.packpath:append(vim.fn.expand(test_dir)) -- install packer local install_path = test_dir .. "/pack/packer/start/packer.nvim" local install_plugins = false if vim.fn.empty(vim.fn.glob(install_path)) > 0 then vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path) vim.cmd("packadd packer.nvim") install_plugins = true end local packer = require("packer") packer.init({ package_root = test_dir .. "/pack", compile_path = test_dir .. "/plugin/packer_compiled.lua", }) packer.startup(function(use) use("wbthomason/packer.nvim") use({ "mfussenegger/nvim-dap" }) use({ "nvim-neotest/neotest", requires = { "vim-test/vim-test", "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", "antoinemadec/FixCursorHold.nvim", "sidlatau/neotest-dart", }, config = function() require("neotest").setup({ adapters = { require("neotest-dart")({ command = "flutter", }), }, output = { open_on_run = false, }, discovery = { enabled = false, }, diagnostic = { enabled = true, }, floating = { border = "rounded", max_height = 0.8, max_width = 0.8, options = {}, }, quickfix = { enabled = false, }, log_level = vim.log.levels.DEBUG, }) end, }) if install_plugins then packer.sync() end end) vim.cmd([[ command! NeotestSummary lua require("neotest").summary.toggle() command! NeotestFile lua require("neotest").run.run(vim.fn.expand("%")) command! Neotest lua require("neotest").run.run(vim.fn.getcwd()) command! NeotestNearest lua require("neotest").run.run() command! NeotestDebug lua require("neotest").run.run({ strategy = "dap" }) command! NeotestAttach lua require("neotest").run.attach() command! NeotestOutput lua require("neotest").output.open() ]]) ```Steps to reproduce the behavior:
flutter create .
neovim
with provided minimum configuration.:e test/widget_test.dart
Expected behavior Test end should get success status.
Logs
neotest.log
file instdpath("log")
orstdpath("data")
.log_level = vim.log.levels.DEBUG
in your neotest setup config.Logs
Additional context I am author of
neotest-dart
adapter. Not sure where is the problem - if it is in the adapter, I will gladly fix it. But I do not see any interfaces for finishing test from adapter.