CODE 项目整体迁移至码云平台(https://gitee.com)公告
OS_Mirror / joe CoffeeScript

项目最近一次提交:4 年多 前 49aa66983

README.md

Joe

Build Status NPM version Flattr this project

Joe is a JavaScript testing framework that actually works. Unlike Mocha, we won't die on you abruptly when executing dynamically created tests and are always able to associate the correct test to the correct corresponding test suite. Switching from Mocha is trivial and only takes a few minutes.

Install

Backend

  1. Install Node.js
  2. npm install --save-dev joe joe-reporter-console

Frontend

  1. See Browserify

Usage

Example

// define your test suite
require('joe').describe('suite name', function(describe,it){
    // group together items into sub suites if you desire
    describe('sub suite name', function(describe,it){
        // create both synchronous and asynchronous tests
        it('synchronous test', function(){
            // do your stuff
        });
        it('asynchronous test name', function(complete){
            setTimeout(function(){
                // do your stuff
                complete();
            },500);
        });
    });
    // you can also define tests dynamically when using the completion callback on the group
    describe('lets create dynamic tests', function(describe,it,done){
        setTimeout(function(){
            it('a synchronous dynamic test',function(){
                // do your stuff
            });
            done();
        },500)
    });
});
$ node example.js 
suite name
suite name ➞  sub suite name
suite name ➞  sub suite name ➞  synchronous test
suite name ➞  sub suite name ➞  synchronous test ✔   
suite name ➞  sub suite name ➞  asynchronous test name
suite name ➞  sub suite name ➞  asynchronous test name ✔   
suite name ➞  sub suite name ✔  
suite name ➞  lets create dynamic tests
suite name ➞  lets create dynamic tests ➞  a synchronous dynamic test
suite name ➞  lets create dynamic tests ➞  a synchronous dynamic test ✔   
suite name ➞  lets create dynamic tests ✔  
suite name ✔  

3/3 tests ran successfully, everything passed

Complete API

Complete API guide here.

Custom Reporters

Instructions and listing here.

History

You can discover the history inside the History.md file

License

Licensed under the incredibly permissive MIT License
Copyright © 2012+ Bevry Pty Ltd