@@ -102,27 +102,28 @@ local function create_adapter(config)
102102
103103 function DotnetNeotestAdapter .is_test_file (file_path )
104104 local logger = require (" neotest.logging" )
105- local dotnet_utils = require (" neotest-vstest.dotnet_utils" )
106- local client_discovery = require (" neotest-vstest.client" )
105+ local lib = require (" neotest.lib" )
107106
108107 local isDotnetFile = (vim .endswith (file_path , " .csproj" ) or vim .endswith (file_path , " .fsproj" ))
109- or (vim .endswith (file_path , " .cs" ) or vim .endswith (file_path , " .fs" ))
108+ or (vim .endswith (file_path , " .cs" ) or vim .endswith (file_path , " .fs" ))
110109
111110 if not isDotnetFile then
112111 return false
113112 end
114113
115- local project = dotnet_utils .get_proj_info (file_path )
116- local client = client_discovery .get_client_for_project (project , solution )
114+ local file_content = lib .files .read (file_path )
117115
118- if not client then
119- logger .debug (
120- " neotest-vstest: marking file as non-test file since no client was found: " .. file_path
121- )
122- return false
116+ -- Check for common test attributes or patterns in the file content
117+ local test_patterns = { " %[%Test%]" , " %[%Fact%]" , " %[Theory%]" }
118+ for _ , pattern in ipairs (test_patterns ) do
119+ if file_content :match (pattern ) then
120+ logger .debug (" neotest-vstest: marking file as test file due to matched test pattern: " .. file_path )
121+ return true
122+ end
123123 end
124124
125- return true
125+ logger .debug (" neotest-vstest: marking file as non-test file due to no test patterns: " .. file_path )
126+ return false
126127 end
127128
128129 function DotnetNeotestAdapter .filter_dir (name , rel_path , root )
0 commit comments