From 9e1b8f4570509ae7a4937f7107566b8e85bcf383 Mon Sep 17 00:00:00 2001 From: austin Date: Thu, 5 Feb 2026 20:41:04 -0500 Subject: [PATCH] Cursor unit-test-runner rule --- .cursor/rules/unit-test-runner.mdc | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .cursor/rules/unit-test-runner.mdc diff --git a/.cursor/rules/unit-test-runner.mdc b/.cursor/rules/unit-test-runner.mdc new file mode 100644 index 00000000..62079b18 --- /dev/null +++ b/.cursor/rules/unit-test-runner.mdc @@ -0,0 +1,37 @@ +--- +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.