0.9.1 • Published 12 years ago
ntest v0.9.1
ntest
Simple unit testing tool for nodejs
Install
sudo npm install ntest -g
Usage
Create test files named like: test-foo.js or test-bar.js. And then run:
ntest test-directory
test/test-example.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 () {
// });
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
License
ntest is released under the MIT license: