ntest

Simple testing tool for nodejs

ntest

Simple unit testing tool for nodejs

sudo npm install ntest -g

Create test files named like: test-foo.js or test-bar.js. And then run:

ntest test-directory
test/test-example.js --- ```js var assert = require('assert');

beforeEach(function() { console.log('before each test in this file'); });

afterEach(function() { console.log('after each test in this file'); });

beforeAll(function () { console.log('before all tests in this file'); });

afterAll(function() { console.log('after all tests in this file'); });

test('simple test', function () { assert.equal('hello', 'he' + 'llo'); });

test('async test', function (done) { process.nextTick(function () { // if the done function would not be called, // the test would fail with a timeout done(); }); });

// use bang(!) as first letter in test name to execute only this test // test('!execute only this test', function () { // });

<!-- /INSERT -->
 
 
Todos
-----
 
* Find test files in sub-directories
* Detect global created variables
* Allow the async-timeout to be configured
* Allow the test-file-naming-scheme to be configured
 
 
Credits
-------
 
Inspired by mocha
 
http://visionmedia.github.com/mocha/
 
 
License
-------
 
ntest is released under the MIT license:
 
http://www.opensource.org/licenses/MIT