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

[BUG] test discovery is wrong when running NTestRunNearest #242

Open
duguyue100 opened this issue Apr 27, 2023 · 2 comments
Open

[BUG] test discovery is wrong when running NTestRunNearest #242

duguyue100 opened this issue Apr 27, 2023 · 2 comments
Assignees

Comments

@duguyue100
Copy link

NeoVim Version
Output of nvim --version

NVIM v0.9.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/__w/neovim/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/build/src/nvim/auto -I/__w/neovim/neovim/build/include -I/__w/neovim/neovim/build/cmake.config -I/__w/neovim/neovim/src -I/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

Describe the bug
A clear and concise description of what the bug is.

As shown in the following image, when running NetstRunNearest, after it's finished, the checkmark is actually not at the line of the test function, but the one above. At first, I thought this is a misalignment, but later I found out that this actually runs the test above this one.

image

To Reproduce

This is all I have for configuring neotest

" === NeoTest ===
let test#python#pytest#options = "--color=yes"
command NTestRun :lua require("neotest").run.run(vim.fn.expand("%"))
command NTestRunNearest :lua require("neotest").run.run()
command NTestStopNearest :lua require("neotest").run.stop()
command NTestSummaryOpen :lua require("neotest").summary.open()
command NTestSummaryClose :lua require("neotest").summary.close()
command NTestSummaryToggle :lua require("neotest").summary.toggle()
command NTestOutput :lua require("neotest").output.open({ enter = true })

Expected behavior
A clear and concise description of what you expected to happen.

The checkmark at the test function line and actually run the correct test.

@duguyue100
Copy link
Author

Also, here is my setup

require("neotest").setup({
  diagnostic = {
    enabled = true
  },
  adapters = {
    require("neotest-vim-test")({ allow_file_types = { "python" } }),
  },

  highlights = {
    passed = "NeotestPassed",
    running = "NeotestRunning",
    failed = "NeotestFailed",
    skipped = "NeotestSkipped",
    test = "NeotestTest",
    namespace = "NeotestNamespace",
    focused = "NeotestFocused",
    file = "NeotestFile",
    dir = "NeotestDir",
    border = "NeotestBorder",
    indent = "NeotestIndent",
    expand_marker = "NeotestExpandMarker",
    adapter_name = "NeotestAdapterName",
    select_win = "NeotestWinSelect",
    marked = "NeotestMarked",
  },

  icons = {
    expanded = "",
    collapsed = "",
    passed = "✅",
    running = "✨",
    failed = "❌",
    unknown = "❔",
  },
})

@rcarriga
Copy link
Collaborator

I can't reproduce so I'm not sure what the issue is. Does using neotest-python have any effect?

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

2 participants