# Affected Tests in CI
Run only the tests a change actually touches.
`rustcodegraph affected` traces import dependencies transitively to find which test files are affected by a set of changed source files — so CI can run only the relevant tests.
```bash
rustcodegraph affected src/utils.ts src/api.ts # pass files as arguments
```
## Options
| `--stdin` | Read the file list from stdin | `false` |
| `-d, --depth <n>` | Max dependency traversal depth | `5` |
| `-f, --filter <glob>` | Custom glob to identify test files | auto-detect |
| `-j, --json` | Output as JSON | `false` |
| `-q, --quiet` | Output file paths only | `false` |
## CI / hook example
```bash
#!/usr/bin/env bash
npx vitest run $AFFECTED
fi
```