A / superagent-mocker

Pretty simple in-browser mocks for CRUD and REST API
132 stars 32 forks source link

Double call callback #46

Closed maxkoryukov closed 7 years ago

maxkoryukov commented 7 years ago

Here: https://github.com/A/superagent-mocker/blob/master/index.js#L98

Such code:


try {
    // ...
    // Code code code
    // ...

    // call 1
    cb && cb(error, null);
  } else {
    cb && cb(null, response);
  }
} catch (ex) {
  // call 2
  cb && cb(ex, null);
}

If you will try to use it with mocha and expect you will get callback doublecall, trying to assert in callback.

If this repo is alive - I could send a test case (not ready right now), and, probably, a PR

maxkoryukov commented 7 years ago

@tbranyen could you take a look on this problem (and related PR: #47)

I am using fork as a workaround for current issue.

If you have doubts does this problem really exist - I could send you tiny test case (I think, it could become another one test case)