package
Enable support for generators in Mocha with backward compatibility.
npm install thunk-mochaGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 2 packages.
40.5 kB
Includes dependencies.
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!
npm install thunk-mochaCall by mocha in CLI:
mocha -r thunk-mochaCall in js file:
// make sure that `mocha` have loaded
require('thunk-mocha')()
// or: require('thunk-mocha')(require('mocha'))After patched, mocha support:
it('support sync test', function () {
// do some test
})
it('support thunk style async test', function (done) {
// do some test
done()
})
it('support promise style async test', function () {
// do some test
return promiseLikeObject
})
it('support generator style async test', function * () {
// do some test
yield promise
// yield thunk
// yield generator
// ...
})
it('support async/await style async test',