Articles tagged 'nodejs'
-
Unit testing the jQuery Rambling Slider - Part 2 - The DOM, jQuery and node.js
November 9, 2011
This post was originally published in the Rambling Labs Blog on November 9, 2011.
In order to continue to add tests to the jQuery Rambling Slider, I needed to test something against the DOM. Problem is, you don’t count with the DOM when you’re running the Jasmine tests from console. So what should I do?
As expected, I found that there is a DOM emulator in node.js :D. Also, to test using jQuery I needed to download the corresponding node package. So I didn’t waste any time and went ahead to install them:
npm install -g jsdom npm install -g jquery
So now, I can write something like this in my
src/jquery.plugins.coffee
:(($) -> $.fn.reverse = [].reverse )(jQuery)
And test it on my
spec/jquery.plugins.spec.coffee
with something like this… -
Unit testing the jQuery Rambling Slider - CoffeeScript, Jasmine and node.js
November 9, 2011
This post was originally published in the Rambling Labs Blog on November 9, 2011.
As you may know, I have been working lately on the jQuery Rambling Slider. One of my personal milestones with this project is to write as many unit tests as possible, so I began my research.
Honestly, I didn’t know where to begin. I remember to have read once on twitter that someone was writing their tests with Jasmine and CoffeeScript, so that could be a good starting point (and it sounds really fun too!). I have worked with Jasmine before and it sure was a great experience. It’s yet another productivity tool made by the great Pivotal Labs guys.
After googling for a while, I stumbled into a post from someone that was writing tests in Jasmine and node.js