Skip to content

Commit a2d8ba7

Browse files
authored
fix(discovery): test if file contains test (#46)
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 2fbb821 commit a2d8ba7

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
@@ -129,6 +129,18 @@ local function create_adapter(config)
129129
return false
130130
end
131131

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

0 commit comments

Comments
 (0)