{"action":"opened","issue":{"url":"https://api.github.com/repos/sinonjs/lolex/issues/224","repository_url":"https://api.github.com/repos/sinonjs/lolex","labels_url":"https://api.github.com/repos/sinonjs/lolex/issues/224/labels{/name}","comments_url":"https://api.github.com/repos/sinonjs/lolex/issues/224/comments","events_url":"https://api.github.com/repos/sinonjs/lolex/issues/224/events","html_url":"https://github.com/sinonjs/lolex/issues/224","id":372363832,"node_id":"MDU6SXNzdWUzNzIzNjM4MzI=","number":224,"title":"clearInterval(intervalId) results in infinite loop with clock.runAll()","user":{"login":"jshado1","id":3012099,"node_id":"MDQ6VXNlcjMwMTIwOTk=","avatar_url":"https://avatars1.githubusercontent.com/u/3012099?v=4","gravatar_id":"","url":"https://api.github.com/users/jshado1","html_url":"https://github.com/jshado1","followers_url":"https://api.github.com/users/jshado1/followers","following_url":"https://api.github.com/users/jshado1/following{/other_user}","gists_url":"https://api.github.com/users/jshado1/gists{/gist_id}","starred_url":"https://api.github.com/users/jshado1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshado1/subscriptions","organizations_url":"https://api.github.com/users/jshado1/orgs","repos_url":"https://api.github.com/users/jshado1/repos","events_url":"https://api.github.com/users/jshado1/events{/privacy}","received_events_url":"https://api.github.com/users/jshado1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-21T22:28:24Z","updated_at":"2018-10-21T22:28:24Z","closed_at":null,"author_association":"NONE","body":"```\r\nError: Aborting after running 50 timers, assuming an infinite loop!\r\n  at Object.runAll (node_modules/lolex/src/lolex-src.js:753:19)\r\n```\r\n\r\n* Lolex version : `3.0.0`\r\n* Environment   : NodeJS `10.7.0`\r\n* Other libraries you are using: Enzyme `3.7.0`, Mocha `5.2.0`, SinonChai `3.2.0`\r\n\r\n**What did you expect to happen?**\r\nThe interval to be cancelled.\r\n\r\n**What actually happens**\r\nThe interval continues indefinitely.\r\n\r\n**How to reproduce**\r\n```jsx\r\nclass Test extends React.PureComponent<{},{}> {\r\n    // …\r\n    doSomething = () => {\r\n        someDep();\r\n    }\r\n    componentDidMount() {\r\n        this.intervalId = setInterval(this.doSomething, 10000);\r\n    }\r\n    componentWillUnmount() {\r\n         clearInterval(this.intervalId);\r\n    }\r\n    // …\r\n}\r\n```\r\n\r\n```jsx\r\ndescribe('<Test/>', () => {\r\n    const sandbox = createSandbox();\r\n    const ss = {};\r\n\r\n    before(() => {\r\n        ss.someDep = sandbox.stub(someDep, 'default');\r\n        ss.clock = sandbox.useFakeTimers({\r\n            loopLimit: 50,\r\n        });\r\n    });\r\n\r\n    afterEach(() => {\r\n        sandbox.resetHistory();\r\n    });\r\n\r\n    after(() => {\r\n        sandbox.restore();\r\n    });\r\n\r\n    it('should stop after unmount', () => {\r\n        shallow(<Test />)\r\n            .unmount();\r\n\r\n        ss.clock.runAll();\r\n        expect(ss.someDep).to.have.been.calledOnce;\r\n    });\r\n});\r\n```\r\n\r\n<details>\r\n<summary>Log of intervalId and clearInterval</summary>\r\n\r\n**`intervalId`**:\r\n\r\n```js\r\n{ id: 36,\r\n  ref: [Function: ref],\r\n  unref: [Function: unref],\r\n  refresh: [Function: refresh] }\r\n```\r\n\r\n**`clearInterval`**:\r\n\r\n```js\r\n{ [Function]\r\n  hadOwnProperty: true,\r\n  clock:\r\n   { now: 10000,\r\n     timeouts: {},\r\n     Date:\r\n      { [Function: ClockDate]\r\n        now: [Function: now],\r\n        toString: [Function: toString],\r\n        parse: [Function: parse],\r\n        UTC: [Function: UTC],\r\n        clock: [Circular],\r\n        hadOwnProperty: true },\r\n     loopLimit: 50,\r\n     setTimeout: { [Function: setTimeout] hadOwnProperty: true },\r\n     clearTimeout: { [Function: clearTimeout] hadOwnProperty: true },\r\n     nextTick: [Function: nextTick],\r\n     setInterval: { [Function: setInterval] hadOwnProperty: true },\r\n     clearInterval: { [Function: clearInterval] hadOwnProperty: true },\r\n     setImmediate: { [Function: setImmediate] hadOwnProperty: true },\r\n     clearImmediate: { [Function: clearImmediate] hadOwnProperty: true },\r\n     countTimers: [Function: countTimers],\r\n     requestAnimationFrame: [Function: requestAnimationFrame],\r\n     cancelAnimationFrame: [Function: cancelAnimationFrame],\r\n     runMicrotasks: [Function: runMicrotasks],\r\n     tick: [Function: tick],\r\n     next: [Function: next],\r\n     runAll: [Function: runAll],\r\n     runToFrame: [Function: runToFrame],\r\n     runToLast: [Function: runToLast],\r\n     reset: [Function: reset],\r\n     setSystemTime: [Function: setSystemTime],\r\n     hrtime: { [Function: hrtime] hadOwnProperty: true },\r\n     uninstall: [Function],\r\n     methods:\r\n      [ 'setTimeout',\r\n        'clearTimeout',\r\n        'setImmediate',\r\n        'clearImmediate',\r\n        'setInterval',\r\n        'clearInterval',\r\n        'Date',\r\n        'hrtime' ],\r\n     _setTimeout: { [Function] hadOwnProperty: true, clock: [Object] },\r\n     _clearTimeout: { [Function] hadOwnProperty: true, clock: [Object] },\r\n     _setImmediate: { [Function] hadOwnProperty: true, clock: [Object] },\r\n     _clearImmediate: { [Function] hadOwnProperty: true, clock: [Object] },\r\n     _setInterval: { [Function] hadOwnProperty: true, clock: [Object] },\r\n     _clearInterval: { [Function] hadOwnProperty: true, clock: [Object] },\r\n     _Date:\r\n      { [Function: ClockDate]\r\n        now: [Function: now],\r\n        toString: [Function: toString],\r\n        parse: [Function: parse],\r\n        UTC: [Function: UTC],\r\n        clock: [Object],\r\n        hadOwnProperty: true },\r\n     _hrtime: { [Function] hadOwnProperty: true, clock: [Object] },\r\n     restore: [Function],\r\n     timers:\r\n      { '33': [Object], '34': [Object], '35': [Object], '36': [Object] },\r\n     duringTick: false } }\r\n```\r\n\r\n</details>"}}
{"actor":{"display_login":"jshado1"}}