While working on the codebase tonight, I discovered some unnecessary duplication:
https://github.com/sinonjs/sinon/blob/master/lib/sinon/default-behaviors.js#L266-L272
// create asynchronous versions of callsArg* and yields* methods
forEach(Object.keys(module.exports), function (method) {
// need to avoid creating anotherasync versions of the newly added async methods
if (method.match(/^(callsArg|yields)/) && !method.match(/Async/)) {
module.exports[method + "Async"] = createAsyncVersion(method);
}
});
and
https://github.com/sinonjs/sinon/blob/master/lib/sinon/behavior.js#L216-L222
// create asynchronous versions of callsArg* and yields* methods
forEach(Object.keys(proto), function (method) {
// need to avoid creating anotherasync versions of the newly added async methods
if (method.match(/^(callsArg|yields)/) && !method.match(/Async/)) {
proto[method + "Async"] = createAsyncVersion(method);
}
});
We should refactor the code to only have one copy of this, and re-use it.
@mroderick I'd like to pick up this task. Any suggestions on where to put a new util function?
@LEQADA that would be great 馃憤
I think you could create a file in lib/sinon/util/core
@LEQADA did you make any progress on this? I'd like to pick this up if it's not being worked on 馃槃
@morgsmccauley sorry for a long inactivity. I already started to work on the issue but didn't have time to write tests. I plan to finish it next week if it's not urgent. If it's urgent then sure take it over.
Otherwise I'd ask to give me some more days. :slightly_smiling_face:
There are plenty more issues across the sinonjs repositories with "Help wanted" label.
LIke this one to find a solution for an unmaintained dependency: https://github.com/sinonjs/nise/issues/66
Great, thanks @mroderick!
Fixed with #1942