Why doesn’t nodejs Debian package provide the “node” binary used by all my tools?

Recently, I had to use my CI to host a new node project. Up until now I had it all setup and was already able to build, test & deploy other node projects. But, of course, this project was a little different from the others (no “special snowflake”, but still different ;) as it used gulp / browserify. My problem was that I could not run my gulp jobs on their own and would always get a “could not find ‘node’ : no such file or directory” error. I went ahead and checked and the same thing happened when I ran a few tests on my Ubuntu machine, it came as a bit of a surprise but then I remembered that I usually always use npm to run everything, not directly tools. But Node runs on those machines! So why the error message? :-/

The debian package deploys a

1
nodejs
binary instead of
1
node
… that’s why! But why the odd naming? Everybody else uses
1
node
!

Let’s have a look at why =)

Sometimes, things just go the Murphy’s law way

Consulting often means you can’t do whatever you like in terms of infrasturcture. Here I’m going to talk about my current assignment, the continuous integration platform we need to use, and how upgrading it turned out to be a bit of a puzzle =)

Why the hell doesn’t PhantomJS work anymore! I’ve just reinstalled my modules …

I’ve been using PhantomJS on various projects in the past months. PhantomJS is definitely a useful tool but, more often than you’d like, it is related to weird build or test errors. Last time for me, I was unable to properly install my modules and even when npm gave me an OK after multiple attempts, test builds using PhantomJS would still crash.

Oh noez! Mai VM iz not bootin after distro updatz! Halp!

Well, sometimes you update something on your distro and suddently your VMs stop working. The fix can be very easy but I tend to always forget it so “I’ll remember it so you don’t have to” as the Nostalgia Critic would say ;)

The issue

When you come from strongly typed compiled languages, you often use specific tools to get your stubbing / mocking going (not that they’re mandatory but they generally make your life easier). Many options exist :

  • google test for your C / C++
  • Rhino mocks for C#
  • Mockito for Java
  • and more …

Usually, you get your favourite library, set it up, import it in your test setup, and then the fun can begin.

In some regard in the Javascript world, SinonJS allows you to do this, at least partially. It allows mocking in your class / object prototype and does a nice job at that. But what if you want to stub internals you don’t want exposed like some DB connector, a passport strategy … ?