Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion codeflash/languages/java/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def __init__(self) -> None:
self._language_version: str | None = None
self._test_framework: str = "junit5"

self._config_cache: dict[Path, Any] = {}

@property
def language(self) -> Language:
"""The language this implementation supports."""
Expand Down Expand Up @@ -405,7 +407,12 @@ def load_coverage(

def setup_test_config(self, test_cfg: Any, file_path: Path, current_worktree: Path | None = None) -> bool:
"""Detect test framework from project build config (pom.xml / build.gradle)."""
config = detect_java_project(test_cfg.project_root_path)
project_root = test_cfg.project_root_path
try:
config = self._config_cache[project_root]
except KeyError:
config = detect_java_project(project_root)
self._config_cache[project_root] = config
if config is not None:
self._test_framework = config.test_framework
return True
Expand Down
Loading