Renderer/.cursor/rules/unit-test-runner.mdc
austin 9e1b8f4570
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Cursor unit-test-runner rule
2026-02-05 20:41:04 -05:00

38 lines
1.3 KiB
Plaintext

---
description: Unit test runner definition and run-tests-on-commit instruction
alwaysApply: true
---
# Unit Test Runner and Commit Workflow
## Unit Test Runner
This project uses **Maven** to run unit tests (JUnit 5).
- **Command**: `mvn test`
- **Scope**: Runs all tests in `src/test/java` (and `src/main/java` test sources as configured in pom.xml). Excludes integration tests unless a profile is used.
- **Integration tests** (optional): `mvn test -P integration` when you need to run integration tests.
When the agent runs tests, it must use:
```bash
mvn test
```
from the project root (`Renderer`). Ensure Maven is available and the project builds before running tests.
## Run Tests on Every Commit
Whenever the agent **commits code** (via git commit, or when the user asks to commit):
1. **Before committing**: Run the unit test runner (`mvn test`) from the project root.
2. If tests **fail**, do not commit. Report the failures and fix or revert the changes.
3. If tests **pass**, proceed with the commit.
If the user explicitly asks to commit without running tests (e.g. "commit anyway" or "skip tests"), you may skip this step only when they clearly request it.
## Summary
- **Test command**: `mvn test` (project root)
- **Rule**: Run `mvn test` before every commit; block commit on failure unless the user asks to skip.