co-test
An wapper that enables generators to be used in unit test, inspired by co
Last updated a year ago by sunkuo .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install co-test 
SYNC missed versions from official npm registry.

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()
  }))
})

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 1
Last Week 1
Last Month 2
Dependencies (1)
  • co ^4.6.0
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |