Test-only branches
What a test-only-branch finding of fallow audit means, why it matters and how to fix it.
What it reports
The change adds a test-environment branch to source code.
Changed code explains how fallow finds it.
Why it matters
The tests run a path that production never runs. A passing test then does not prove that the production path works.
Example
A change adds if (process.env.NODE_ENV === 'test') return cached; to src/pricing.ts.
Fix
Prefer a seam that tests can inject, such as a parameter or a module mock. If the branch is intended, suppress it with // fallow-ignore-next-line test-only-branch.
Facts
| Fact | Value |
|---|---|
| Issue type | test-only-branch |
| Rule id in SARIF output | fallow/test-only-branch |
| Command | fallow audit |
| Default severity | warn |
Config key in rules | test-only-branch |
| Suppression comment | // fallow-ignore-next-line test-only-branch |
Fixable with fallow fix | No |
| Opt-in | No |