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: Failed to find matching position id for key #43

Closed
4 tasks done
polirritmico opened this issue Jan 1, 2025 · 2 comments · Fixed by #44
Closed
4 tasks done

bug: Failed to find matching position id for key #43

polirritmico opened this issue Jan 1, 2025 · 2 comments · Fixed by #44
Labels
bug Something isn't working

Comments

@polirritmico
Copy link

Did you check docs and existing issues?

  • I have read the documentation
  • I have searched the existing issues
  • I have searched the existing issues of plugins related to this issue (if relevant)
  • I have tried setting log_level to vim.log.levels.debug in neotest.setup and examined the logs.

Neovim version (nvim -v)

NVIM v0.10.3 Build type: Release LuaJIT 2.1.1716656478

Operating system/version

Gentoo Linux 2.17

Describe the bug

Hi!

Starting from 71a9dac the plugin no longer works for me. It throws an error per test like this:

Failed to find matching position id for key <path_to_my_lua_spec_file>::<the "it" string description">::<the first line number of the test>

Reverting to cfd3f1d fix the problem.

After checking the commit, I was able to find the origin of the problem: if the test has square brackets in the description (like most of my tests descriptions) the plugin fails.

describe("[Check names]", function()
  it("[Should handle strings inside brackets]", function()
    assert(true)
  end)
end)

Expected Behavior

It should run the tests without problems regardless of the content in the it description

Output of :checkhealth neotest-busted if relevant

All OK

neotest log output if relevant

No response

Steps To Reproduce

Add the test in the description and run require("neotest").run.run(vim.fn.expand("%"))

@polirritmico polirritmico added the bug Something isn't working label Jan 1, 2025
@MisanthropicBit
Copy link
Owner

MisanthropicBit commented Jan 1, 2025

Thanks for reporting another issue 👍 I can reproduce it.

I guess it would be better to only trim one of the characters if the string had the same character at the start and end such that "[Should handle strings inside brackets]" would become [Should handle strings inside brackets], and only trim [] if they are repeated for a lua string literal [[...]]. I'll make a fix for it.

@MisanthropicBit
Copy link
Owner

@polirritmico do you mind verifying that the PR fixes your issue? I just tested with your examples but I would like to be sure.

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