We do it, then we forget

That’s it! I’ve got a new shiny tool that I want to use for my day to day work. It’s so pretty, it has nice features that’ll help me a lot… But it is not packaged / has a custom installer that’ll create launcher shortcuts /o\ ! (I kinda like to just have to type

1
<META>+"my app name"+<ENTER>
and launch my app instead of having to use my mouse). I always forget how to set it up manually so now I’ll write it down so I (and, hopefuly some readers) don’t have to =)

Ooooh! Shiny!

Oh noez! Dah computa iz broken! /o\

Two days ago, I decided to test the “automagical” upgrade from Ubuntu for my 14.04 LTS. It has been a while since I did that (using a completely automated tool to upgrade a distro on one of my machines), and thought that “well, Ubuntu has made such strides in user friendlyness in the last years, nothing can possibly go wrong w/ new gear, right?”. Alas, it looks like it’s still pretty difficult to achieve (at least on laptops).

At some point when you’re writing tests, you come across frustrating bits that you know are going to rain on your parade and be somewhat of a pain to test (and not for the good reasons). On my end, Dates do fall in that category, and the JS universe is no exception.

Generally, what I want to do when writing my tests is ibeing able to control them (so that I don’t have to deal with things like a

1
Date.now
somewhere I can’t reach which would lead to unreliable tests. In general, I end up testing that by controlling the date (it’s a parameter of the function I’m testing) or stubbing (a function controls the date I’m using, and I’ve not created it just for the sake of testing).

Sometimes, though, you still face issues where you can’t really properly set your date (not accessible because it’s lost somewhere in a lib you don’t control maybe, or it just does not really make sense to extract it). That’s where Sinon.Js’s fake timers can come in handy =)

var clock = sinon.useFakeTimers(now); //sets the date to 'now' (UNIX timestamp)

[... testing occurs ...]

clock.restore(); //get back to the default Date behaviour

It’s not like that behaviour is a hidden feature of Sinon or anything, but it’s not exactly the first thing you bump into when reading the Sinon.Js documentation either (in fact, it’s roughly at the middle of the huge doc page).

It’s not much, but it helps =)

Last thursday afternoon, I went to the node.js Live Paris event. It was less crowded than I expected but it was probably due to the fact that the event took place midweek in the middle of the afternoon. Not a big deal though, it left more room in the comfy IBM conference room for the geeks like me that made it ;)

In my opinion, this event was a bit of a mixed bag but there were some interesting info here and there, which is always cool.

In this piece, I’ll quickly go through what happened