feat: Add codegraph affected command to find test files impacted by changes
Traverses dependency graph to identify which test files depend on changed source files. Supports stdin input for git integration, custom test file patterns, and configurable traversal depth. Useful for targeted test execution in CI/CD pipelines.
This commit is contained in:
+13
-1
@@ -148,7 +148,19 @@ export class GraphQueryManager {
|
||||
const nodes = this.queries.getNodesByFile(filePath);
|
||||
const dependents = new Set<string>();
|
||||
|
||||
// For each exported symbol in this file, find imports
|
||||
// Check file-level incoming import edges (file:X imports file:Y)
|
||||
const fileNode = nodes.find((n) => n.kind === 'file');
|
||||
if (fileNode) {
|
||||
const incomingFileEdges = this.queries.getIncomingEdges(fileNode.id, ['imports']);
|
||||
for (const edge of incomingFileEdges) {
|
||||
const sourceNode = this.queries.getNodeById(edge.source);
|
||||
if (sourceNode && sourceNode.filePath !== filePath) {
|
||||
dependents.add(sourceNode.filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Also check node-level imports of exported symbols
|
||||
for (const node of nodes) {
|
||||
if (node.isExported) {
|
||||
const incomingEdges = this.queries.getIncomingEdges(node.id, ['imports']);
|
||||
|
||||
Reference in New Issue
Block a user