@@ -150,19 +150,31 @@ def resolve_test_file_from_class_path(test_class_path: str, base_dir: Path) -> P
150150 # Handle file paths (contain slashes and extensions like .js/.ts)
151151 if "/" in test_class_path or "\\ " in test_class_path :
152152 # This is a file path, not a Python module path
153+ # Try the path as-is if it's absolute
154+ potential_path = Path (test_class_path )
155+ if potential_path .is_absolute () and potential_path .exists ():
156+ return potential_path
157+
153158 # Try to resolve relative to base_dir's parent (project root)
154159 project_root = base_dir .parent
155160 potential_path = project_root / test_class_path
156- if potential_path .exists ():
157- return potential_path
161+ # Normalize to resolve .. and . components
162+ try :
163+ potential_path = potential_path .resolve ()
164+ if potential_path .exists ():
165+ return potential_path
166+ except (OSError , RuntimeError ):
167+ pass
168+
158169 # Also try relative to base_dir itself
159170 potential_path = base_dir / test_class_path
160- if potential_path .exists ():
161- return potential_path
162- # Try the path as-is if it's absolute
163- potential_path = Path (test_class_path )
164- if potential_path .exists ():
165- return potential_path
171+ try :
172+ potential_path = potential_path .resolve ()
173+ if potential_path .exists ():
174+ return potential_path
175+ except (OSError , RuntimeError ):
176+ pass
177+
166178 return None
167179
168180 # First try the full path (Python module path)
@@ -731,16 +743,25 @@ def parse_jest_test_xml(
731743 if not test_file_path .exists ():
732744 test_file_path = base_dir / test_file_name
733745
734- if test_file_path is None or not test_file_path .exists ():
746+ # For Jest tests in monorepos, test files may not exist after cleanup
747+ # but we can still parse results and infer test type from the path
748+ if test_file_path is None :
735749 logger .warning (f"Could not resolve test file for Jest test: { test_class_path } " )
736750 continue
737751
738752 # Get test type if not already set from lookup
739- if test_type is None :
753+ if test_type is None and test_file_path . exists () :
740754 test_type = test_files .get_test_type_by_instrumented_file_path (test_file_path )
741755 if test_type is None :
742- # Default to GENERATED_REGRESSION for Jest tests
743- test_type = TestType .GENERATED_REGRESSION
756+ # Infer test type from filename pattern
757+ filename = test_file_path .name
758+ if "__perf_test_" in filename or "_perf_test_" in filename :
759+ test_type = TestType .GENERATED_PERFORMANCE
760+ elif "__unit_test_" in filename or "_unit_test_" in filename :
761+ test_type = TestType .GENERATED_REGRESSION
762+ else :
763+ # Default to GENERATED_REGRESSION for Jest tests
764+ test_type = TestType .GENERATED_REGRESSION
744765
745766 # For Jest tests, keep the relative file path with extension intact
746767 # (Python uses module_name_from_file_path which strips extensions)
0 commit comments