Muex.DependencyAnalyzer
(Muex v0.6.1)
View Source
Analyzes test files to determine which tests depend on which modules.
Builds a dependency graph by parsing test files and extracting module references. This allows running only the tests that are affected by a specific mutation.
Summary
Functions
Analyzes test files and builds a dependency map.
Gets test files that depend on a specific module.
Gets test files for a mutation based on the mutated module.
Types
Functions
@spec analyze([Path.t()] | Path.t()) :: dependency_map()
Analyzes test files and builds a dependency map.
Parameters
test_paths- List of test directories, globs, or file paths (default: ["test"])
Returns
Map of module atoms to list of test file paths that reference them.
Examples
iex> analyze(["test"])
%{MyModule => ["test/my_module_test.exs"], ...}
@spec get_dependent_tests(module(), dependency_map()) :: [Path.t()]
Gets test files that depend on a specific module.
Parameters
module_name- The module to find tests fordependency_map- The dependency map fromanalyze/1
Returns
List of test file paths that depend on the module.
@spec get_tests_for_mutation(map(), dependency_map(), %{ required(Path.t()) => module() }) :: [Path.t()]
Gets test files for a mutation based on the mutated module.
Parameters
mutation- The mutation map containing location infodependency_map- The dependency map fromanalyze/1file_to_module- Map of file paths to module names
Returns
List of test file paths to execute for this mutation.