{"action":"reopened","issue":{"url":"https://api.github.com/repos/sinonjs/sinon/issues/1691","repository_url":"https://api.github.com/repos/sinonjs/sinon","labels_url":"https://api.github.com/repos/sinonjs/sinon/issues/1691/labels{/name}","comments_url":"https://api.github.com/repos/sinonjs/sinon/issues/1691/comments","events_url":"https://api.github.com/repos/sinonjs/sinon/issues/1691/events","html_url":"https://github.com/sinonjs/sinon/issues/1691","id":296796280,"number":1691,"title":"Broken matchers since Sinon v4.2.3","user":{"login":"JoeTheFkingFrypan","id":2607260,"avatar_url":"https://avatars0.githubusercontent.com/u/2607260?v=4","gravatar_id":"","url":"https://api.github.com/users/JoeTheFkingFrypan","html_url":"https://github.com/JoeTheFkingFrypan","followers_url":"https://api.github.com/users/JoeTheFkingFrypan/followers","following_url":"https://api.github.com/users/JoeTheFkingFrypan/following{/other_user}","gists_url":"https://api.github.com/users/JoeTheFkingFrypan/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeTheFkingFrypan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeTheFkingFrypan/subscriptions","organizations_url":"https://api.github.com/users/JoeTheFkingFrypan/orgs","repos_url":"https://api.github.com/users/JoeTheFkingFrypan/repos","events_url":"https://api.github.com/users/JoeTheFkingFrypan/events{/privacy}","received_events_url":"https://api.github.com/users/JoeTheFkingFrypan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-13T16:16:36Z","updated_at":"2018-02-13T18:06:56Z","closed_at":null,"author_association":"NONE","body":"### Context ###\r\n\r\n* Sinon version : Bug reproducible in `v4.2.3` and `v4.3.0`\r\n* Environment   : Windows 10 / Linux using `node v8`\r\n* Other libraries you are using: `Mocha v5.0.0`,\r\n\r\n**What did you expect to happen?**\r\n\r\n- This test use to pass using `sinon v4.2.2`\r\n- Expected behaviour: matcher function should be run\r\n\r\n**What actually happens**\r\n\r\n- This test fails after upgrading to `sinon v4.2.3+` (introduction of `formatio` fork)\r\n\r\n**How to reproduce**\r\n\r\n##### Partial unit test #####\r\n\r\n```javascript\r\n// parseActivity.test.js\r\n\r\nconst sonicBusStub = {\r\n  emit: sinon.stub().resolves()\r\n};\r\n\r\nconst parseActivity = proxyquire('../parseActivity', {\r\n  './sonic-bus': sonicBusStub,\r\n});\r\n\r\nafterEach(() => {\r\n  sonicBusStub.emit.resetHistory();\r\n})\r\n\r\n// Matcher testing whether input value is instance of moment or not\r\nconst isMoment = sinon.match(value => {\r\n  console.log(value);\r\n  console.log(moment.isMoment(value));\r\n\r\n  return moment.isMoment(value);\r\n}, true);\r\n\r\nit.only('Should emit an event when successfully parsed an activity', async () => {\r\n  await parseActivity.run({\r\n    appName: 'test',\r\n    transactionId: '123transactionId',\r\n  });\r\n\r\n  sonicBusStub.emit.should.have.been.calledOnce();\r\n  sonicBusStub.emit.should.have.been.calledWithMatch('activities.12345.parsed', {\r\n    activity: {},\r\n    createdAt: isMoment,\r\n    transactionId: '123transactionId',\r\n  });\r\n});\r\n```\r\n\r\n##### Tested function #####\r\n\r\n```javascript\r\n// parseActivity.js\r\n'use strict';\r\n\r\nconst moment = require('moment');\r\nconst sonicBus = require('./sonic-bus');\r\n\r\n/**\r\n * @param {Object} payload Input payload\r\n * @returns {Object} Sport Heroes activity\r\n */\r\nfunction parseActivity(payload) {\r\n  const { transactionId } = payload;\r\n  const eventName = 'activities.12345.parsed';\r\n  const params = {\r\n    transactionId,\r\n    activity: {},\r\n    createdAt: moment(),\r\n  };\r\n\r\n  return sonicBus.emit(eventName, params);\r\n}\r\n\r\nmodule.exports = ({\r\n  run: parseActivity,\r\n  errorCode: 'BROKEN_PARSE_ACTIVITY',\r\n});\r\n```\r\n\r\n### Samples running on CircleCI ###\r\n\r\n#### Using Sinon `v4.2.2` ####\r\n\r\n![image](https://user-images.githubusercontent.com/2607260/36160371-4967b45a-10e1-11e8-940d-963355afa00d.png)\r\n\r\n#### Using Sinon `v4.2.3` ####\r\n\r\n![image](https://user-images.githubusercontent.com/2607260/36160435-72460da4-10e1-11e8-945f-664b56dd4999.png)\r\n\r\n#### Using Sinon `v4.3.0` ####\r\n\r\n![image](https://user-images.githubusercontent.com/2607260/36160475-89e84c92-10e1-11e8-9d9a-dc96277dce76.png)\r\n\r\n"}}
{"actor":{"display_login":"JoeTheFkingFrypan"}}