A Node testing framework inspired by MiniTest for Ruby.
I like the idea of making tests methods on an object. I find it acts as a nice natural divider to make sure each test file isn't doing too much.
var MiniJest = require'./index.js';var testMyThing = ;// all tests are added to the fn objectthisassertEqual2 + 3 4;;// nothing happens without this line!testMyThingrun;
To run your tests, just execute them through Node:
$ node myTest.js
You can change the reporter like so:
var MiniJest = require'./index.js';var testMyThing = ;// called when test passes;// called when test fails;// called when an async test times out;testMyThingrun;
var MiniJest = require'./index.js';var testMyThing = ;// a new matcher that always fails// matchers added to the matchers object// a failed matcher is expected to throw an errorthrow 'test failed';;thisalwaysFailsAssertion;;testMyThingrun;
MiniJest handles async a little differently. An async test takes a callback, but you pass that callback a function in which you make your assertions:
setTimeoutvar res = 5;donethisassertEqualres 5;;500;;
This seems a little odd but is actually quite a nice way of doing things in practice.