-
Notifications
You must be signed in to change notification settings - Fork 40
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
sinon v11 broke sinon.match assertions on your mock #24
Comments
Thanks for the info. I've updated Sinon to v11 in the latest v0.5.0. I think peer dependencies would not work here as the lib uses Sinon itself. |
this broke again with sinon@13 |
@m-ronchi can you create a repo with minimal reproduction, please? And provide npm / yarn version with it. My quick test with npm 8.5.3 and yarn 1.22.17 worked well. In package.json: "dependencies": {
"@aws-sdk/client-sns": "3.32.0"
},
"devDependencies": {
"sinon": "13.0.1",
"@types/sinon": "9.0.10",
"@aws-sdk/types": "3.32.0"
} test: import {assert, match} from 'sinon';
import {mockClient} from 'aws-sdk-client-mock';
import {PublishCommand, SNSClient} from '@aws-sdk/client-sns';
const snsMock = mockClient(SNSClient);
beforeEach(() => {
snsMock.reset();
});
it('works with sinon', async () => {
const sns = new SNSClient({});
await sns.send(new PublishCommand({TopicArn: 'my:topic', Message: 'msg'}));
assert.calledWithExactly(snsMock.send, match.any);
}) sinon version installed at node_modules root is the one from the package.json (13.0.1). |
sorry, it turned out that the error message was confusing AF |
your package depends on
sinon
v9, that depends on@sinonjs/samsam
v5 (the package used to implement matchers)sinon released v11 that depends on @sinonjs/samsam v6.
installing sinon v11 in my project together with aws-sdk-client-mock results in duplicates of both packages installed, thus breaking tests with assertions like this:
you should either:
sinon.match*
through your packageThe text was updated successfully, but these errors were encountered: