Skip to content

bug: assertion failed! in result-parser.lua when running tests #474

@GCorbel

Description

@GCorbel

Did you check docs and existing issues?

  • I have read all the plugin docs
  • I have searched the existing issues
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.12.0-dev

Operating system/version

Ubuntu 25.10

Describe the bug

When running a test using nvim-java's test runner, I get an assertion error in the result parser:

vim.schedule callback: ...lugged/nvim-java/lua/java-test/results/result-parser.lua:123: assertion failed!
stack traceback:
        [C]: in function 'assert'
        ...lugged/nvim-java/lua/java-test/results/result-parser.lua:123: in function <...lugged/nvim-java/lua/java-test/results/result-parser.lua:120>
        ...lugged/nvim-java/lua/java-test/results/result-parser.lua:58: in function 'parse'
        ...i/.vim/plugged/nvim-java/lua/java-test/reports/junit.

The error occurs at line 123 in result-parser.lua:

function TestParser:parse_test_failed(data, line_iter)
	local test_id = tonumber(data[1])
	local node = self:find_result_node(test_id)
	assert(node)  -- <-- fails here

It appears that find_result_node returns nil for a test ID that was reported in the test output but wasn't registered during test discovery.

Steps To Reproduce

  1. Open a Java test file
  2. Run :JavaTestRunCurrentMethod (or equivalent test command)
  3. Observe the assertion error
  4. Expected behavior:

Expected Behavior

The test should run and display results without crashing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions