r/angular
•
u/younesjd
•
2d ago
•
1
I open-sourced an agent skill for Angular testing, so you might actually enjoy reviewing the tests your coding agents write
The skill teaches agents how to write behavioral and readable tests:
- No
fixture.whenStable()andfixture.detectChanges()soup. Actually, no morefixtureπ - Fakes over mocks: more robust, more readable, and it drastically reduces the cost of mock maintenance for your agents, and you.
- Through the DOM: test what the user sees, not
fixture.my.private.implementation.details - Vitest Browser Mode first (jsdom and happy-dom still work)
- Signals, guards, routing and timers: dedicated guidance for each, like fast-forwarding time instead of hardcoding delays.
- Migrating from Jest or Karma to Vitest
Try it: npx skills add marmicode/skills -s angular-testing
https://github.com/marmicode/skills#angular-testing
The skill is evaluated on each change to avoid regressions.
A good first step: ask your agent to rewrite one of your existing tests with it.
The skill is evaluated on every change to catch regressions, so if you see anything that could be improved, please open an issue. The more real-world scenarios it covers, the better the skill gets for everyone.
5
u/DMezhenskyi 1d ago
Already use it and already love it. Great job, Younes ππ»
5
u/laradvil 1d ago
I never once tested my codes, but damn this looks tempting. Nice one bruh
3
u/MichaelSmallDev 1d ago
Thank you for this. I have been rolling out a new wave of unit testing on our frontend and have been wanting details like this beyond the adev testing docs. I just read all these over and this answers a lot of questions I had about unit testing and vitest in general, so these will make for good skills to have.
1
u/Prod_Meteor 2d ago
Do you mean, a tool?
1
u/Straker741 1d ago
Looks really good! Thank you very much.
1
u/GeromeGrignon 1d ago
Planning to use it for Optimus UI!
1
u/makmn1 2d ago
Awesome!!! I learned all I know about modern Angular testing from your Marmicode Cookbook and have been creating / reviewing tests using those patterns for over a year now. I'm definitely going to try out this skill and compare it against my own instructions to see if I can contribute back anything. Thanks Younes!