Testpilot: a promise-friendly node.js test framework

115 views
Skip to first unread message

Chris Osborn

unread,
Feb 29, 2012, 11:41:46 AM2/29/12
to q-con...@googlegroups.com
Hi everyone,

Those of you doing Node.js development may be interested in a new unit testing tool I recently released, called Testpilot. You can find it at http://github.com/capsela/testpilot or install it directly with `npm install testpilot`. It is a drop-in replacement for nodeunit (provided you don't depend on nodeunit's more esoteric features and reporters), but adds better support for promise-based code:

- assertion methods accept promises directly: you don't need to explicitly wait for them to resolve before asserting
- test methods can return promises to indicate test completion: no need to wait for a promise to resolve before calling test.done()

I also tried to improve on nodeunit in a few other ways unrelated to promises, and you can find more info on the Github page. At this point Testpilot is light on features but generally works well. If you like it but think it is missing something, then please help me prioritize further development by posting to the github issue tracker. Thank you for your interest, and I look forward to any feedback.

- Chris Osborn

Kris Kowal

unread,
Feb 29, 2012, 5:07:16 PM2/29/12
to q-con...@googlegroups.com
It might be worth mentioning that making a timeout for a test is
trivial in this system:

exports['test foo'] = function (assert) {
return Q.call(function () {
// do some asyncness
})
.timeout(1000)
};

I will try to take a deeper look.

It looks like it hones pretty close to my spec. I would love feedback.

http://kriskowal.github.com/uncommonjs/tests/specification

Kris Kowal

Reply all
Reply to author
Forward
0 new messages