I've been struggling to wrap my head around how to not only test directives, but how to approach teaching others how to test directives. I've been working on this github page with examples of common AngularJS things and how to test them, and how could I even pretend the list was complete without covering directives? I was looking at two resources today that opened my eyes a little bit, and I'll try to convey what I learned in this post.
Before, I was making my directory structures way more complicated then they needed to be. I had a main "git repositories" folder, and then inside of that I would use mkdir to create a new folder for each project. Then I would cd inside of that and run:
If you are going to be doing a lot of work in a command prompt you then you should enjoy it. It should be easy to read in terms of size and colors. It should be practical and functional but still show off your own personal style.
It should be noted that you can be running your angular application locally and testing it in your browser (updating automatically when a file changes from good old browsersyc) while at the same time you have your tests runner (karma, in my case) running from the command line with autoWatch turned on. This is a fantastic way to develop. I have said many times that I feel browsersync spoils developers and leads them away from TDD and good testing, but actually browsersync can be pretty useful to have open as a sanity check with the unit tests as your main source of truth. Here's a meme that I created from the "Why not Both?" image:
The posts on this site are written and maintained by Jim Lynch. About Jim...