Category Archives: JavaScript

sinon vs rewire: when do I use which?

In node.js testing, there are 2 helper modules that I use often: sinon and rewire. Sinon allows you to monkey-patch functions, while rewire allows you to… monkey-patch functions. Both modules have other uses as well, but in this post I’m … Continue reading

Posted in JavaScript, node.js, software development, testing | Tagged , , , , , , , | 1 Comment

Paybox integration using node.js – with example HTML

This post will help you get Paybox integration to work using node.js. You can find a full working example in the src/paybox-integration dir of my blog code repository. Paybox is a French payment provider. Getting their integration to work can be quite a … Continue reading

Posted in JavaScript, node.js, software development | 1 Comment

Checking log4js output in your node.js testsuite

This post will teach you how to test  log4js  log statements in your code. You can also find the code below in the src/log4js-unittest dir of my blog code repository. Let’s say that we have written this simple node.js module, foo.js . … Continue reading

Posted in JavaScript, node.js, software development | Tagged , , , , , , , , , , , , , , | Leave a comment

Combining mongoose and Q in node.js

This post will teach you how to write promise-based mongoose code, using Kris Kowal’s Q library. You can also find the code below in the src/mongoose-and-q dir of my blog code repository. We have a mongo database with 3 collections: users, … Continue reading

Posted in JavaScript, node.js, software development | Tagged , , , , , , , , , | 4 Comments

Processing an array of promises sequentially in node.js

This post describes how you can perform a sequence of promises sequentially – one after another – using Kriskowal’s Q library in node.js. If you’re just interested in how to do this, and not in the other examples, scroll down … Continue reading

Posted in JavaScript, node.js, software development | Tagged , , , , , , , , , , , , | 6 Comments