thunks/thunk-mocha

Name: thunk-mocha

Owner: thunks

Description: Enable support for generators in Mocha with backward compatibility.

Created: 2015-09-25 05:43:28.0

Updated: 2017-06-11 07:49:09.0

Pushed: 2016-10-10 07:49:39.0

Homepage:

Size: 10

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

thunk-mocha

Enable support for generators in Mocha with backward compatibility.

NPM version Build Status Downloads

It is similar to Co Mocha, but it is a different implementation and more powerful. It is a perfect patch for mocha!

Installation
install thunk-mocha
Usage

Call by mocha in CLI:

a -r thunk-mocha

Call in js file:

ake sure that `mocha` have loaded
ire('thunk-mocha')()
r: require('thunk-mocha')(require('mocha'))
Example

After patched, mocha support:

support sync test', function () {
 do some test


support thunk style async test', function (done) {
 do some test
ne()


support promise style async test', function () {
 do some test
turn promiseLikeObject


support generator style async test', function * () {
 do some test
eld promise
 yield thunk
 yield generator
 ...


support async/await style async test', async function () {
 do some test
ait promise


support Rx.Observable style async test', function () {
 do some test
turn Rx.Observable.bindNodeCallback(fs.stat)('package.json')


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.