Added asserts from Christian Johansen's Test-Driven Javascript Development book #153

wants to merge 5 commits into


None yet
1 participant

Chapter 14 covers unit testing in node using a forked version of nodeunit from a few years ago. Since I want to use the latest version of nodeunit in my tests, but find the additional asserts from Christian's book helpful, I thought it would be useful if I made an attempt at including them.

Now, Christian has a side project named node-assert-extras, but I couldn't easily see how to get that to play well with the nodeunit assert.js. Instead, I just included a bunch of his assert additions into nodeunit assert.js.

I'm almost done reading chapter 14 and have only found one difference: he maps test.noException and variation to test.doesNotThrow. I saw no need to add these additional mappings.

In short, this pull request does 99% of the work one needs to do in order to allow people using Christian's book to simply use the latest version of nodeunit. Not to mention, it adds some very nice additional asserts. I was hoping that someone would have already done the work to port those changes in, and indeed perhaps someone has but the pull request was rejected for some reason. I am willing to do the legwork to get this into the mainline, so please let me know if you want me to do something.

looks like test.notEquals() from the book also does not work. One must use test.notEqual() instead. Still does not change pull request.

godsflaw commented Jun 2, 2012


godsflaw added some commits Sep 8, 2012

Added assert for isBuffer
Added assert for isBuffer using the Buffer.isBuffer check.  Also merged up
to current master.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment