{"action":"created","issue":{"url":"https://api.github.com/repos/sinonjs/sinon/issues/860","labels_url":"https://api.github.com/repos/sinonjs/sinon/issues/860/labels{/name}","comments_url":"https://api.github.com/repos/sinonjs/sinon/issues/860/comments","events_url":"https://api.github.com/repos/sinonjs/sinon/issues/860/events","html_url":"https://github.com/sinonjs/sinon/issues/860","id":108964352,"number":860,"title":"Backwards incompatible change for sinon.createStubInstance between version 1.17 and 1.16","user":{"login":"sterlinghw","id":8450364,"avatar_url":"https://avatars.githubusercontent.com/u/8450364?v=3","gravatar_id":"","url":"https://api.github.com/users/sterlinghw","html_url":"https://github.com/sterlinghw","followers_url":"https://api.github.com/users/sterlinghw/followers","following_url":"https://api.github.com/users/sterlinghw/following{/other_user}","gists_url":"https://api.github.com/users/sterlinghw/gists{/gist_id}","starred_url":"https://api.github.com/users/sterlinghw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sterlinghw/subscriptions","organizations_url":"https://api.github.com/users/sterlinghw/orgs","repos_url":"https://api.github.com/users/sterlinghw/repos","events_url":"https://api.github.com/users/sterlinghw/events{/privacy}","received_events_url":"https://api.github.com/users/sterlinghw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-09-29T21:31:57Z","updated_at":"2015-10-01T07:15:13Z","closed_at":null,"body":"It looks like `createStubInstance` does not work the same in version 1.17 when compared to 1.16. I have two examples of using `createStubInstance`, but each example only works in their respective versions.\r\n\r\n#### works in 1.17\r\n```javascript\r\n'use strict';\r\n\r\nlet sinon = require('sinon');\r\nlet assert = require('assert');\r\n\r\nclass a {\r\n  constructor() {\r\n    console.log('called constructor');\r\n  }\r\n\r\n  foo() {\r\n    return 'bar';\r\n  }\r\n}\r\n\r\nlet mock = sinon.createStubInstance(a);\r\nmock.foo.returns('baz');\r\n\r\nassert.equal(mock.foo(), 'baz');\r\n```\r\n\r\n#### works in 1.16 \r\n```javascript\r\n'use strict';\r\n\r\nlet sinon = require('sinon');\r\nlet assert = require('assert');\r\n\r\nclass a {\r\n  constructor() {\r\n    console.log('called constructor');\r\n  }\r\n\r\n  foo() {\r\n    return 'bar';\r\n  }\r\n}\r\n\r\nlet mock = sinon.createStubInstance(a);\r\nsinon.stub(mock, 'foo').returns('baz');\r\n\r\nassert.equal(mock.foo(), 'baz');\r\n```\r\nNotice the differences for stubbing `foo`. \r\n\r\n`sinon.stub(mock, 'foo').returns('baz')` throws `TypeError: Attempted to wrap foo which is already wrapped` in 1.17 and `mock.foo.returns('baz')` throws `TypeError: mock.foo.returns is not a function` in 1.16.\r\n\r\nApparently, 1.17 stubs each of the methods when creating an instance whereas 1.16 did not. "},"comment":{"url":"https://api.github.com/repos/sinonjs/sinon/issues/comments/144641006","html_url":"https://github.com/sinonjs/sinon/issues/860#issuecomment-144641006","issue_url":"https://api.github.com/repos/sinonjs/sinon/issues/860","id":144641006,"user":{"login":"mroderick","id":20321,"avatar_url":"https://avatars.githubusercontent.com/u/20321?v=3","gravatar_id":"","url":"https://api.github.com/users/mroderick","html_url":"https://github.com/mroderick","followers_url":"https://api.github.com/users/mroderick/followers","following_url":"https://api.github.com/users/mroderick/following{/other_user}","gists_url":"https://api.github.com/users/mroderick/gists{/gist_id}","starred_url":"https://api.github.com/users/mroderick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mroderick/subscriptions","organizations_url":"https://api.github.com/users/mroderick/orgs","repos_url":"https://api.github.com/users/mroderick/repos","events_url":"https://api.github.com/users/mroderick/events{/privacy}","received_events_url":"https://api.github.com/users/mroderick/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T07:15:13Z","updated_at":"2015-10-01T07:15:13Z","body":"I vote for bumping the major version (publish from `master`, there are other changes). We might have to retire the 1.17.x releases so far, so people won't use them, thinking they're safe. We can create a 1.x branch, that we will keep updating for some time (six months?)."}}