| 1 | name: unit-testing-rules |
| 2 | version: 0.0.1 |
| 3 | schema: v1 |
| 4 | rules: |
| 5 | - name: unit-testing-rules |
| 6 | rule: >- |
| 7 | For unit testing in this project: |
| 8 | |
| 9 | 1. The project uses Vitest and Jest for testing. Prefer Vitest |
| 10 | |
| 11 | 2. Run tests from within the specific package directory (e.g., `cd core && ..` |
| 12 | |
| 13 | 3. For vitest tests, |
| 14 | - Test files follow the pattern `*.vitest.ts` |
| 15 | - Run tests using `vitest` from within the specific package/module |
| 16 | directory: `cd [directory] && vitest -- [test file path]` |
| 17 | |
| 18 | 4. For jest tests, |
| 19 | - Test files follow the pattern `*.test.ts` |
| 20 | - Run tests using `npm test` from within the specific package/module |
| 21 | directory: `cd [directory] && npm test -- [test file path]` |
| 22 | - The test script uses experimental VM modules via NODE_OPTIONS flag |
| 23 | |
| 24 | 5. For both |
| 25 | - Write tests as top-level `test()` functions - DO NOT use `describe()` |
| 26 | blocks |
| 27 | - Include the function name being tested in the test description for |
| 28 | clarity |