testit

Because the world needs a simpler testing framework

MIT License

Downloads
521
Stars
7
Committers
5

testit

Because the world needs a simpler testing framework. Check out the travis build log for an example of test output and check out the test folder for an example test suite.

This module also works seamlessly with istanbul for code coverage (see package.json) and sauce-test for browser testing via browserify.

Installation

npm install testit

Sample test script

var assert = require('assert')
var test = require('testit')

test('synchronous tests', function () {
  test('passes tests that do not fail', function () {
    assert(true)
  })
  test('fails tests that fail', function () {
    assert(false)
  })
})

test('asynchronous tests with callbacks', function () {
  test('passes some async tests', function (done) {
    setTimeout(done, 100)
  })
  test('fails some async tests', function (done) {
    setTimeout(function () {
      done(new Error('oh dear'))
    }, 100)
  })
  test('times out some tests', function (done) {
    setTimeout(function () {
      done()
    }, 99999999999)
  })
  test('supports custom timeouts', function (done) {
    setTimeout(done, 1000)
  }, {timeout: '1 second'})
})
test('supports promises just as well as callbacks', function () {
  return new Promise(function (resolve) {
    setTimeout(resolve, 100)
  })
})

License

MIT

Package Rankings
Top 5.29% on Npmjs.org
Badges
Extracted from project README
Build Status Coverage Status Dependency Status NPM version Sauce Test Status