Test is marked as failed when it succeded
Not sure why. I have a multiline describe do.. block. I attach a screenshot.
It also succeeds in the console
Here's my setup:
require("neotest").setup({
adapters = {
require("neotest-elixir")({}),
}
})
vim.keymap.set('n', '<leader>tr', function() require('neotest').run.run() end)
vim.keymap.set('n', '<leader>ta', function() require("neotest").run.run(vim.fn.expand("%")) end)
vim.keymap.set('n', '<leader>td', function() require("neotest").run.run({strategy = "dap"}) end)
vim.keymap.set('n', '<leader>tp', function() require("neotest").output_panel.toggle() end)
Does the describe name have any special characters or a dynamic value (string interpolation)?
describe "Condition 1.
payor override = HHSC
TMHP Managed Care not active with line of business = STAR STAR+PLUS STAR Kids or MMP
TMHP Service Authorization NPI & Provider matches Roster Payor" do
test "no alert if payor override != HHSC", %{resident_0: context} do
This is the example
Btw, do you know how to run the test but not open the floating window? I'm using the output_panel
It seems I completely forgot about describes when I implemented multiline test names. I don't have many of those in my work project, so I hadn't noticed. Dynamic test names aren't supported either.
Btw, do you know how to run the test but not open the floating window? I'm using the output_panel
See :h neotest.Config.output.
I have another similar case for this test: https://github.com/rudiejd/exercism-exercises/blob/f68783e18579f361e63ce875e4b197c55b3f51be/elixir/captains-log/test/captains_log_test.exs#L33
There is no dynamic test name, but the start with NCC- test was displayed as failing when in reality other tests were failing. When I expand the results, I can see that the start with NCC- test wasn't the one failing.
Strangely, the output file shows this test as succeeding:
{
"id": "/home/jd/exercism/elixir/captains-log/test/captains_log_test.exs::random_ship_registry_number::start with \"NCC-\"",
"output": "/tmp/nvim.jd/zMpzmd/28/test_output_122641753",
"status": "passed",
"seed": 0,
"errors": []
}
And the output is just the generic Test passed output. So I think that something might be going wrong in between the results and the display of tests to the user
Probably related to the quotes in the test name.
Good call! That fixes it.
I'm not sure whether the quote issue is an issue with the neotest-elixir adapter or with the neotest code upstream. The results file indicate that the test is passing, but neotest.state.status_counts indicates that removing the quotes adds one successful test
Probably neotest-elixir. Special characters need to be handled explicitly on the Neovim lua side of the adapter.
I'll open a separate issue for this one then, and maybe take a crack at it later :+1: