Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to have calls satisfying <function>: Error when a spy that isn't mentioned is called by the function #28

Open
papandreou opened this issue Jan 22, 2016 · 0 comments

Comments

@papandreou
Copy link
Member

I once did something like this:

var spy1 = sinon.spy().named('spy1');
spy1(123);
var spy2 = sinon.spy().named('spy2');
expect([spy1], 'to have calls satisfying', function () {
    spy1(123);
    spy2(456);
});

... which currently passes because the assertion is only tracking the spies that are passed as the subject.

Unfortunately there's no easy way to detect the spy2(456); call as there's no useful require('sinon').spy().__proto__ or similar to snoop into, and sinon doesn't keep track of all the spies it has created, except when using a sandbox (#15).

Ideas are very welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants