You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 17, 2023. It is now read-only.
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!
Installation
npm install thunk-mocha
Usage
Call by mocha in CLI:
mocha -r thunk-mocha
Call in js file:
// make sure that `mocha` have loadedrequire('thunk-mocha')()// or: require('thunk-mocha')(require('mocha'))
Example
After patched, mocha support:
it('support sync test',function(){// do some test})it('support thunk style async test',function(done){// do some testdone()})it('support promise style async test',function(){// do some testreturnpromiseLikeObject})it('support generator style async test',function*(){// do some testyieldpromise// yield thunk// yield generator// ...})it('support async/await style async test',asyncfunction(){// do some testawaitpromise})it('support Rx.Observable style async test',function(){// do some testreturnRx.Observable.bindNodeCallback(fs.stat)('package.json')})
About
Enable support for generators in Mocha with backward compatibility.