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

Tests that are not actually run are marked as passing #40

Closed
jstensland opened this issue Jun 23, 2024 · 6 comments · Fixed by #42
Closed

Tests that are not actually run are marked as passing #40

jstensland opened this issue Jun 23, 2024 · 6 comments · Fixed by #42
Labels
bug Something isn't working

Comments

@jstensland
Copy link

When I trigger an individual test in a testify suite, it is marked as passing even if no test was run. The run spec produces the following command, which doesn't match the test, due to it being in a testify suite and needing ^SuiteName/TestName$

  command = { "go", "test", "-json", "-v", "-race", "-count=1", "-timeout=60s", "-run", "^TestName$" },

I know that's not supported yet, but if you try to run an individual test and no tests are run, it seems like it should fail and warn, not pass silently

@fredrikaverpil
Copy link
Owner

fredrikaverpil commented Jun 24, 2024

Good suggestion, and sounds like it could be quite straight forward to fix this.

My guess is we could set the status to "skipped" (and warn, like you mention) if the "no tests to run" message appears in the output for that test execution.

I'll look into this during the week.

@fredrikaverpil fredrikaverpil added the bug Something isn't working label Jun 24, 2024
@fredrikaverpil
Copy link
Owner

fredrikaverpil commented Jun 24, 2024

@jstensland if you wish, you can give #42 a try by configuring neotest-golang to use the PR's branch:

return {
  {
    "nvim-neotest/neotest",
    dependencies = {
      "nvim-neotest/nvim-nio",
      "nvim-lua/plenary.nvim",
      "antoinemadec/FixCursorHold.nvim",
      "nvim-treesitter/nvim-treesitter",
      {
         "fredrikaverpil/neotest-golang", -- Installation
+        branch = "skip-tests-not-found",
      }
    },
    config = function()
      require("neotest").setup({
        adapters = {
          require("neotest-golang"), -- Registration
        },
      })
    end,
  },
}

@jstensland
Copy link
Author

Not sure if it's just my setup, but that config looked for skip-tests-not-found in the nvim-neotest/neotest repo.

I was able to point at your branch though and it works well. Thanks for the quick work!

@fredrikaverpil
Copy link
Owner

Oof, my bad, I edited the post above. I misplaced the branch directive! 🤦

@jstensland
Copy link
Author

Thanks for the edit, as that's simpler than what I did. I'm definitely still learning lua, lazy.nvim etc. I'm still surprised every time you can just trade out the type of a config value between string, table or function. 🤷

@fredrikaverpil
Copy link
Owner

fredrikaverpil commented Jun 24, 2024

Hehe, yeah, same here. It took some time to wrap my head around that more or less everything in Lua is a (potentially nested) table and it's incredibly easy to make mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants