Skip to content

Commit 1503e76

Browse files
authored
Merge pull request #37 from paralleldrive/claude/update-tdd-test-utils-011CUR6ynuCB73g4t8v8htr8
docs: add Vitest/Riteway test utils tips to TDD rules
2 parents 49538ce + 9303662 commit 1503e76

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

ai/rules/tdd.mdc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ Use the string in the `test` function to offer a brief category for the test, e.
5555

5656
Because of conflicts with the `assert` function API and description, avoid the `it` wrapper entirely, if possible.
5757

58+
## Default Test Utils
59+
60+
For Vitest/Riteway tests:
61+
- Spies and stubs: vi.fn and vi.spyOn
62+
- Vitest ships tinyspy under the hood. Simple, fast, and no extra deps.
63+
- Module mocking: vi.mock with vi.importActual for partial mocks
64+
- Works cleanly with ESM. Avoid require.
65+
- Timers: vi.useFakeTimers and vi.setSystemTime
5866

5967
Constraints {
6068
Unless directed otherwise, always colocate tests with the code they are testing.

0 commit comments

Comments
 (0)