maxtaco / tamejs

JavaScript code rewriter for taming async-callback-style code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tamejs can't work with mocha?

freewind opened this issue · comments

The problem is I didn't use mocha correctly.

It should be wrote as:

describe('test', function(){
  it('show ok with tamejs', function(done){
     console.log('### testing ...');
     var result;
     await { inc(1, defer(result)); }
     console.log('result: ' + result);
     result.should.equal(123456); // won't pass
     done();
  });
});

Please notice the done, it used in mocha to determine if a asynchronous invocation has finished or not. Without it, mocha won't wait for the asynchronous invocation.