Socket
Socket
Sign inDemoInstall

cocha

Package Overview
Dependencies
17
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cocha

Run mocha with generators + co


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Install size
877 kB
Created
Weekly downloads
 

Readme

Source

Cocha

Ripped shamelessly from https://labnotes.org/yield-to-the-test-using-mocha-with-es6-generators/

first install with

npm install cocha
npm install mocha

then you can test co friendly mocha code:

var thunkify = require('thunkify');
var assert = require('assert');
var fs = require('fs');

describe('cocha', function(){

  it('should work when async', function *(){
    function read(file, fn) {
      setTimeout(function(){
        fn(null, 'file: ' + file);
      }, 5);
    }

    read = thunkify(read);

    var res = yield read('foo.txt');
    assert('file: foo.txt' == res);
  })

})

testing: npm test

Keywords

FAQs

Last updated on 29 Aug 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc