Skip to content

vpArth/simple-test-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status NPM version

simple-test-runner

#Basic nodejs test suits runner

Install

npm install simple-test-runner

##Usage:

var Tests = require('simple-test-runner')
  , tests = new Tests(__dirname + '/test_suits')
  ;

tests.start();

Test suits directory should contain some 'test-' prefixed test suits. Each suit runs as a separate process. Sample suit:

var Test = require('simple-test-runner').Test
  , test = new Test('simple suit')
  ;
//name, tester(success_callback, fail_callback)
//success or fail should be triggered after test complete
test.add('Success Test', function setEmptyWorker(success, fail) {
  setTimeout(function () {
    if(true) success();
    else fail();
  }, 100);
});

//test that error throwed, third parameter same as expected error(type and message)
test.add('Catch Error Test', Test.catch(function () {
  throw new Error('Some Error');
}, new Error('Some Error')));

test.run(function(res){
  process.exit(res);
});

About

Simple NodeJS moduled unit testing helper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published