Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test is marked as failed when it succeded #44

Open
rlopzc opened this issue Jul 31, 2024 · 9 comments
Open

Test is marked as failed when it succeded #44

rlopzc opened this issue Jul 31, 2024 · 9 comments

Comments

@rlopzc
Copy link

rlopzc commented Jul 31, 2024

Not sure why. I have a multiline describe do.. block. I attach a screenshot.

image

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)

@jfpedroza
Copy link
Owner

Does the describe name have any special characters or a dynamic value (string interpolation)?

@rlopzc
Copy link
Author

rlopzc commented Jul 31, 2024

  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

@rlopzc
Copy link
Author

rlopzc commented Jul 31, 2024

Btw, do you know how to run the test but not open the floating window? I'm using the output_panel

@jfpedroza
Copy link
Owner

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.

@rudiejd
Copy link

rudiejd commented Nov 14, 2024

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.
image
image

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

@jfpedroza
Copy link
Owner

Probably related to the quotes in the test name.

@rudiejd
Copy link

rudiejd commented Nov 14, 2024

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

@jfpedroza
Copy link
Owner

Probably neotest-elixir. Special characters need to be handled explicitly on the Neovim lua side of the adapter.

@rudiejd
Copy link

rudiejd commented Nov 15, 2024

I'll open a separate issue for this one then, and maybe take a crack at it later 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants