1.0.0 • Published 8 years ago

co-test v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

co-test is a wapper that enables generators to be used in unit test, inspired by co.

Installation

$ npm install co-test

Usage

co-test lets you write your unit test by using generator functions. Like this:

/*
  global describe it
 */
'use strict'
require('should')
var wrap = require('co-test');
describe('Test Module', function () {
  it('Test Case', wrap(function * (done) {
    let result = yield Promise.resolve(1)
    result.should.be.equal(1)
    done()
  }))
})

When Error occur, co-test can catch it and show you

/*
  global describe it
 */
'use strict'
require('should')
var wrap = require('co-test');
describe('Test Module', function () {
  it('Test Case', wrap(function * (done) {
    //Error Occur When you run this unit test
    let result = yield Promise.reject(1)
    result.should.be.equal(1)
    done()
  }))
})
1.0.0

8 years ago