# Monorepos

> How trimtest finds projects in a monorepo, how nested projects and workspace members work, and how to override detection.

trimtest walks the repository for project markers (a `pyproject.toml`, `package.json`, `Cargo.toml`, `go.mod`,
`pubspec.yaml`, `Package.swift`, `build.zig`, `pom.xml`, `build.gradle*`, ...) and treats each as a project with
its own adapter, runner and baseline.

```bash
trimtest detect      # which projects were found, and how many tests each tracks
trimtest check       # validate trimtest.toml and list what would be detected
```

## Nested projects and workspace members

A project nested under another is its own project **unless** it is a workspace member of it: npm, pnpm and yarn
workspaces, `go.work` and `replace`, uv and PDM workspaces, and Cargo and Gradle or Maven modules. Members are part
of their parent, so a change in one member can select tests in another.

A project with no tests runs no commands, so a nested example package does not make a runner fail with "no tests ran".

## Controlling detection

```toml
# trimtest.toml
max_depth = 8                      # how deep project markers are searched (default 6)
ignore = ["vendor/**", "examples/**"]

[[project]]                        # force a project the markers cannot find
kind = "python"
dir = "svc"
```

Use `tests = [globs]` to add files that are tests but do not follow the runner's naming convention, and
`import_roots = [dirs]` for extra Python import roots.

## Suites with no import link

End-to-end suites often depend on code they never import. Map the changed paths to the tests yourself:

```toml
[map]
"api/**" = ["web/e2e/**"]
```

## Running one part

```bash
trimtest run --project pytest@api
```
