munit.js - microunit testing for javascript


I just wrote a microlibrary for unit testing in javascript: munit.js. Less than 100 lines of code. Less than 2 kb. Nice.


I needed to test some javascript code so I thought I would do it the proper way and look for a 'professional grade' tool. Something well tested, robust, and supported. Yeah, right.

After scouring the links in pages such as this one I decided I had had enough. I just wanted a simple script to include in my test code, and a way to write tests that didn't smell like Java from two miles away. Something lightweight, and fast. Like Javascript!

It was quicker to write these less-than-100 lines than trying to understand or at least make sense of all those projects.

I could also write at long about the benefits of providing a very simple working example in every open source project page, so that potential users can quickly decide whether the project might work for them or not, but I thought it would be better to lead by example. So here it is. That's how you set up and run tests with munit.js. No prototyping, no enterprise-y robust best practices to follow, no long, tedious and boring set up, no Java servers to run, no clients to instantiate, no interpreters that don't quite work like your browser, nothing else but microtesting!