thunk-mocha
Enable support for generators in Mocha with backward compatibility.
Last updated 10 years ago by zensh .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install thunk-mocha 
SYNC missed versions from official npm registry.

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

npm install thunk-mocha

Usage

Call by mocha in CLI:

mocha -r thunk-mocha

Call in js file:

// make sure that `mocha` have loaded
require('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 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', async function () {
  // do some test
  await promise
})

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

Current Tags

  • 1.0.8                                ...           latest (10 years ago)

11 Versions

  • 1.0.8                                ...           10 years ago
  • 1.0.7                                ...           10 years ago
  • 1.0.6                                ...           10 years ago
  • 1.0.5                                ...           10 years ago
  • 1.0.4                                ...           10 years ago
  • 1.0.3                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |