Skip to content

greenimpala/tiny-runner

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 

tiny-runner

A tiny test runner with async support.

drawing

Installation

$ npm install tiny-runner

Usage

$ node <filename>

Test files should register tests to the register function by passing a name and test callback to the global it function. The runner will execute registered tests on the next tick of the event loop. You may use any standard assertion library.

var runner = require('tiny-runner');

it('can add two numbers', function () {
	var val = add(1, 1);
	assert.equal(2, val)
});

For deferred tests return a Promise/A compatible object. Your test should resolve the promise when done. You may also pass a callback when resolving the promise if you need to make any post-async assertions.

it('can add two numbers via server', function () {
	var def = new Deferred();

	serverAdd(1, 1).then(function (val) {
		def.resolve(function () {
			assert.equal(2, val);	
		});
	});

	return def.promise;
});

Before / After

Use beforeEach(fn) and afterEach(fn) to schedule setup and teardown decorators.

Options

Pass a timeout argument to override the default test timeout.

$ node tests 1000

Tests

Test runners need tests too.

npm test

About

A tiny test runner with async support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published