Should I do unit tests to jQuery?

I am very interested in unit testing and I was wondering if I should unit test jQuery as in my project: portfolio-flex/assets/scripts at master 路 henrikra/portfolio-flex 路 GitHub
Do you guys usually unit test WP themes?

Writing tests is never a bad thing. However I don鈥檛 know many people that actually test themes. WP makes it pretty hard to easily write tests. Especially theme stuff.

If possible it鈥檚 better to extract functionality out of your theme and into separate plugins or mu-plugins. Then leave only the front-end/presentational stuff in the theme. The plugins are easier to test on their own.

1 Like