1.0.2 • Published 9 years ago

tstr v1.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

#tstr - A tiny testing module for javascript. ##What is tstr?

Tstr is a tiny module for running simple tests in javascript.

Example

Testing that 1+1 = 2

var tstr = require('tstr');
var test = tstr(function(t){
  t.equal(1+1, 2);
});
console.log('1 + 1 = 2 is' test.success)
// Logs '1 + 1 = 2 is true' to the console.

##API reference

tstr

var tstr = require('tstr');
tstr(function(t){
  // Tests go here, use t to make tests.
})

equal(x, y)

Passes if x and y are equal

notEqual(x, y)

Passes if x and y are not equal

ok(x)

Passes if x is not falsey

Returned test object

The result of the 1+1 test shown above is:

{ passes: { log: [ '2 equals 2' ], count: 1 },fails: { log: [], count: 0 }, text: ' \nUnnamed test results:\n- 1 tests passed\n- 0 tests failed\n\n- Pass: 2 equals 2\n', success: true }