Skip to content

Commit 828b9fa

Browse files
committed
fix(discovery): test if file contains test
The method to determine if the file is a test file did not take into account that it actually had tests for the file. It just checked that the file is from a project with a client. There may be files that are not test files within the project.
1 parent 83cf9a1 commit 828b9fa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lua/neotest-vstest/init.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,18 @@ local function create_adapter(config)
127127
return false
128128
end
129129

130+
local tests_in_file = client:discover_tests_for_path(file_path)
131+
132+
if not tests_in_file or next(tests_in_file) == nil then
133+
logger.debug(
134+
string.format(
135+
"neotest-vstest: marking file as non-test file since no tests was found in file %s",
136+
file_path
137+
)
138+
)
139+
return false
140+
end
141+
130142
return true
131143
end
132144

0 commit comments

Comments
 (0)