Skip to content

fix(nx-ci): coverage=true still runs test on every affected project#22

Merged
AndriiTsok merged 1 commit intomainfrom
fix/coverage-runs-test-on-all-projects
Apr 18, 2026
Merged

fix(nx-ci): coverage=true still runs test on every affected project#22
AndriiTsok merged 1 commit intomainfrom
fix/coverage-runs-test-on-all-projects

Conversation

@AndriiTsok
Copy link
Copy Markdown
Contributor

Bug

When coverage: true, the workflow REPLACED -t test with -t test:coverage in the Run tests step. That silently skipped every project without a dedicated test:coverage target.

Impact on MCPG consumer: 27 of 28 Rust crates were not being tested at all in CI — only apps/mcpg (which defined test:coverage) ran anything. Plugins, libs, and the secondary app never executed their test suites.

Fix

Run both targets comma-separated:

-t test,test:coverage

Nx gracefully skips projects that don't define a target. Projects with both (e.g. apps/mcpg) run tests twice — once plain, once instrumented — which is fast relative to compile time.

Verification

@monodon/rust does NOT auto-generate test or build targets; it only provides executors + dep graph + nx-release-publish. So the manual nx:run-commands test targets in consumer project.json files are the canonical test path — we just weren't running them when coverage was on.

🤖 Generated with Claude Code

Previously when `coverage: true`, the workflow REPLACED the `test`
target with `test:coverage`. That meant only projects with a
`test:coverage` target got tested at all — everything else was
silently skipped.

In the MCPG workspace that's catastrophic: 27 of 28 Rust crates
have `test` but no `test:coverage`, so CI was effectively only
running the main app's tests. Plugins, libraries, and the other
app were not being exercised at all when coverage was enabled.

Fix: when coverage is on, run BOTH `-t test,test:coverage`. Nx
gracefully skips projects that don't define the target, so only
projects with a dedicated coverage runner (e.g. cargo-llvm-cov)
run the instrumented pass. Everything else still gets a plain
test run.

Projects that define both (like apps/mcpg) will run their tests
twice — once plain, once instrumented. That's fine: tests are
fast vs compile time, and the duplication is only on projects
that opted into both.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AndriiTsok AndriiTsok merged commit 9bbede8 into main Apr 18, 2026
6 checks passed
@AndriiTsok AndriiTsok deleted the fix/coverage-runs-test-on-all-projects branch April 18, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant