Update PhantomJS to test Angular 1.5

TL;DR: npm install karma-phantomjs-launcher@latest phantomjs-prebuilt@latest

Updating an old project to Angular 1.5 all my tests broke or that’s what I thought when I got the Error: [$injector:modulerr] Failed to instantiate module ng due to: TypeError: ‘undefined’ is not an object (evaluating ‘Function.prototype.bind.apply’).

Continue reading

How to test Angular 1.5 components?

TL;DR: We can test components as we were used to test directives.

Yes, you heard all-right, there is a new kid in town and last Friday Angular 1.5 was released bringing us, among other updates, the component sugar. If you want to know more about it Todd Motto explored the component method back in November when it was still beta. Continue reading

Testing Express APIs with Tape and Supertest

Our tech world is an ever changing ecosystem where is hard to stay up to date and keep with all the changes. But it’s always nice to add new things to the toolbox, so since the moment I read Eric Elliot‘s post Why I use Tape Instead of Mocha & So Should You back in summer I wanted to try it.

Three weeks ago I got a project to create an Express API with Redis as the database and I felt it was the perfect moment to try the combination of Tape and Supertest. So I did use it and I have to say I’m surprised by the speed and simplicity. Continue reading

Mocking Services for AngularJS tests

One of the things that I’ve enjoyed more in the last year is Test Driven Development, with the satisfaction of seeing the green after all tests have passed. AngularJS is written with testability in mind which makes testing applications easy. And although it can be hard to grasp at the beginning, there are a lot of good resources around to learn how to unit test the application logic. Continue reading

Using Grunt to run Mocha tests with Backbone.js and RequireJS

I don’t have all the time that I would like for writing here but before the end of the year it’s time for a new blog post.

This year has been really prolific for me learning new things with JavaScript and in the last months I have adopted the Yeoman workflow, which really helps to develop web applications. Continue reading