Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Asynchronous JavaScript Unit Tester

tree: e378549150

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 package.json

Sink Test

An Asynchronous JavaScript Unit Testing Framework designed to run headless, or in the browser.

Sink test is used to test JavaScript that is run asynchronously whereby you tell the test a number of expectations and Sink will tell you if they each pass successfully.

How to write a Sink test

test('should have foo', 2, function() {
  $.ajax('/foo', function(resp) {
    ok(resp.stat == '200')
    assert(resp.text, 'success', 'should have success')

Loading a suite of tests

The above example illustrates the basic syntax of a single test, however loading your tests is done via the sink module which exports the test and ok methods. See the example below:

sink('my module', function(test, ok, before, after, assert) {
  before(function () {
    // run this before every test

  after(function () {
    // run this after every test

  test('should have foo', 2, function () {
    ok(true, 'this is basically true')
    ok(1 == 1, 'also true for you math majors')

sink('another module', function (t, o, b, a) {
  test('a failure', 1, function () {
    ok(1 == 2, 'should fail')

start() // start all test modules

Browser support

Any browser that supports JavaScript as well as Headless via command line with Node. (see below)

// tests.js
var sink = require('sink')
var start = sink.start
sink = sink.sink

sink('some module', function (test, ok) {
  // write tests

sink('another module', function (test, ok) {
  // write tests


in your terminal

$ node path/to/my/tests.js

Happy testing!

Something went wrong with that request. Please try again.