nodeunit icon indicating copy to clipboard operation
nodeunit copied to clipboard

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

Open godsflaw opened this issue 12 years ago • 2 comments

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.

godsflaw avatar Feb 13 '12 23:02 godsflaw

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

godsflaw avatar Feb 14 '12 00:02 godsflaw

bump

godsflaw avatar Jun 02 '12 05:06 godsflaw