Issafalcon / neotest-dotnet

Neotest adapter for dotnet
MIT License
73 stars 29 forks source link

[BUG] - File scoped namespaces in MSTEST don't work with adapter #114

Open ADIX7 opened 4 months ago

ADIX7 commented 4 months ago

If a test file contains file scoped namespace in a mstest project, tests are reported failing although they do pass. As it turns out at the "intermediate results" step the test_name includes the full namespace but at the "MSTest test Nodes" the full_name only containts the class and method name, not the namespace. When converting the file to block style namespace the tests are correctly reported as passing.

By changing in mstest/init.lua this:

local is_match = #result_test_name == #node_data.full_name
    and string.find(result_test_name, node_data.full_name, 0, true)

to this:

local is_match = string.find(result_test_name, node_data.full_name, 0, true) ~= nil

fixes the problem, so it is indeed the missing namespace.