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
Size: 10
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Enable support for generators in Mocha with backward compatibility.
It is similar to Co Mocha, but it is a different implementation and more powerful. It is a perfect patch for mocha!
install thunk-mocha
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'))
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')