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

calledWith(sinon.match(...)) matcher fails even when calledWithMatch passes #108

Open
melink14 opened this issue Jul 19, 2021 · 0 comments

Comments

@melink14
Copy link

dependabot recently tried upgraded my sinon from 7.5 to 11.1 and I was surprised when my tests started failing.

Because they fail when I use native or chai sinon assertions but they don't fail if I use a normal sinon.spy() spy, I thought I would file an issue here. (Especially since the sinon inside of sinon-chrome is quite a bit older than 11.1)

Details:
Assertion:

      expect(chrome.runtime.sendMessage).to.be.calledWith(
        //chrome.runtime.sendMessage.calledWith(
        sinon.match({
          type: 'xsearch',
          text: '先生test',
        })
      );

This fails with:

expected sendMessage to have been called with arguments match(type: xsearch, text: 先生test)
{ dictOption: "2", text: "先生test", type: "xsearch" } match(type: xsearch, text: 先生test)

If I swap the commented lines then it works great (and it also worked with sinon 7.5). This might be expected given sinon-chrome's support level but it seems odd that it works in some cases but not in others.

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

No branches or pull requests

1 participant