Graph operations for dependency analysis and test selection.
Graph operations for dependency analysis and test selection.
(build-dependency-graph {:keys [nodes edges]})
Builds a directed graph from symbol nodes and usage edges.
The graph represents 'uses' relationships: A -> B means 'A uses B'
We'll traverse backwards from tests to find dependencies.
Builds a directed graph from symbol nodes and usage edges. The graph represents 'uses' relationships: A -> B means 'A uses B' We'll traverse backwards from tests to find dependencies.
(find-affected-tests graph test-symbols changed-symbols symbol-graph)
Given a set of changed symbols and a dependency graph, returns the set of test symbols that transitively depend on any changed symbol.
Handles integration tests specially:
Args: graph - loom directed graph of symbol dependencies test-symbols - collection of test symbols or [symbol node-data] pairs changed-symbols - set of symbols that have changed symbol-graph - original symbol graph with node metadata
Returns: Set of test symbols that need to run
Given a set of changed symbols and a dependency graph, returns the set of test symbols that transitively depend on any changed symbol. Handles integration tests specially: - If a test has :test-targets metadata, only run if those targets changed - If a test is marked :integration? but has no targets, run conservatively (always) - Otherwise, use transitive dependency analysis Args: graph - loom directed graph of symbol dependencies test-symbols - collection of test symbols or [symbol node-data] pairs changed-symbols - set of symbols that have changed symbol-graph - original symbol graph with node metadata Returns: Set of test symbols that need to run
(graph-stats graph)
Returns statistics about the dependency graph.
Returns statistics about the dependency graph.
(symbols-with-dependents graph)
Returns a map of symbol -> #{symbols-that-depend-on-it}.
This is useful for finding which tests are affected by a change.
Returns a map of symbol -> #{symbols-that-depend-on-it}. This is useful for finding which tests are affected by a change.
(transitive-dependencies graph symbol)
Returns all transitive dependencies of a symbol.
Given a symbol, walks the graph backwards (in the direction of 'uses') to find all symbols it transitively depends on.
Example: If test-foo uses handler, and handler uses db-query, returns #{handler db-query}
Returns all transitive dependencies of a symbol. Given a symbol, walks the graph backwards (in the direction of 'uses') to find all symbols it transitively depends on. Example: If test-foo uses handler, and handler uses db-query, returns #{handler db-query}
cljdoc builds & hosts documentation for Clojure/Script libraries
Ctrl+k | Jump to recent docs |
← | Move to previous article |
→ | Move to next article |
Ctrl+/ | Jump to the search field |