用摩卡testing时,“rest()多次调用”restler错误

当我testing一个restler调用时,我得到一个done()多次错误。 如果我只让restlers调用onece,那不会出错,但是如果我在同一个testing运行中调用同一个方法两次,那么这个错误是错误的。

这里是testing的简化版本

myModule = require 'myModule' describe 'foo', -> describe 'bar', -> it "should hi", (done) -> myModule.hi done it "should hi again", (done) -> myModule.hi done 

这里是myModule

 rest = require 'restler' exports.hi = (done) -> rest.get('http://google.com' ).on "complete", (data, response) -> console.log 'getting called once' done null, data 

我应该担心与restler的asynchronous多个请求? 什么是造成这个错误?

控制台日志输出,当我添加

  ◦ should hi: getting called once ✓ should hi (221ms) ◦ should hi again: getting called once 1) should hi getting called once ✓ should hi again (211ms) 

看起来这是Restler未被更新为与节点0.10.x兼容的问题

https://github.com/danwrong/restler/pull/113/files

Restler会多次调用这个callback函数,但是有一个pull请求来解决这个问题。