Skip to content

Instantly share code, notes, and snippets.

@karboom
Created October 21, 2016 08:39
Show Gist options
  • Save karboom/53e89def04ea4bbbace8540d8253e6a0 to your computer and use it in GitHub Desktop.
Save karboom/53e89def04ea4bbbace8540d8253e6a0 to your computer and use it in GitHub Desktop.
Use mocha with generator
require('mocha')
exports.co_it = (description, func) => {
it(description, done => {
co(func).then(done).catch(done)
})
}
@karboom
Copy link
Author

karboom commented Oct 21, 2016

// useage
require('should')
const util = require('co_mocha.js')
const it = util.co_it
describe('Get user', function () {
    it('user count should be 10', function *() {
        "1".should.eql(10)
    })
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment