Quick Tip - Angular 2 Modules

Angular 2 has landed! Rejoice! After 18 beta releases and 8 release candidates, the final version saw the light of day in September and you can now consider it stable enough to use it. It’s a totally different framework when you try to compare it with 1.x but the principles are the same. You get the proper tools to build your web application from the UI to the data retrieval and everything in between. The plan is to have multiple quick tips appear here as I play with it. To start this process I will try to explain one of the concepts that took me a while to grasp once I started migrating one of my applications to Angular 2, the module system!

Continue reading

Browserify Unit Testing

Time for the second part of the small unit testing guide that started with this post. In the first part, we’ve introduced a very basic function that calculated the age of a person based on a parameter that represented the year of birth. Before making the calculation, the parameter was checked to make sure it’s a number and if it wasn’t the function threw an error. Both use cases are small and perfect to have some test written for them so let’s begin.

Continue reading

Browserify Unit Testing

Returning to Javascript is always fun and scary at the same time. Lately I’m working on a web application and I wanted to make the experience less scary so I’ve invested some time to the tools that all the cool kids use, Grunt, NPM etc. Through this process I’ve discovered Browserify and I was so, so, so happy with the way it handles dependencies. At last I was able to divide my code in countless little js files. I had some fun with it until I’ve decided to add unit tests. I’ve already had some minor experience with Jasmine so I started messing around with Grunt to make it run my browserify-based tests. That’s when the hair pulling started.

Continue reading