{"action":"created","issue":{"url":"https://api.github.com/repos/jasmine/jasmine-npm/issues/62","labels_url":"https://api.github.com/repos/jasmine/jasmine-npm/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/jasmine/jasmine-npm/issues/62/comments","events_url":"https://api.github.com/repos/jasmine/jasmine-npm/issues/62/events","html_url":"https://github.com/jasmine/jasmine-npm/issues/62","id":121588954,"number":62,"title":"done stops working if code is placed before it","user":{"login":"wiseguy12851","id":1305564,"avatar_url":"https://avatars.githubusercontent.com/u/1305564?v=3","gravatar_id":"","url":"https://api.github.com/users/wiseguy12851","html_url":"https://github.com/wiseguy12851","followers_url":"https://api.github.com/users/wiseguy12851/followers","following_url":"https://api.github.com/users/wiseguy12851/following{/other_user}","gists_url":"https://api.github.com/users/wiseguy12851/gists{/gist_id}","starred_url":"https://api.github.com/users/wiseguy12851/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiseguy12851/subscriptions","organizations_url":"https://api.github.com/users/wiseguy12851/orgs","repos_url":"https://api.github.com/users/wiseguy12851/repos","events_url":"https://api.github.com/users/wiseguy12851/events{/privacy}","received_events_url":"https://api.github.com/users/wiseguy12851/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-10T22:12:46Z","updated_at":"2015-12-11T01:01:00Z","closed_at":null,"body":"I have a test case which tests a promise being called, if it does get called it tests the returned value is correct. However I've noticed that Jasmine works just fine as long as I call done inside the promise `then` function but if I do any checking of the returned value, any loops, or even just a single 1 line `expect` done stops working.\r\n\r\nWhat I mean by stops working is done is clearly there still, its accessible inside the function and its perfectly callable, but calling it doesn't do anything. In fact if I do place `expect` calls before done they don't flag an error if wrong. Non-jasmine code works just fine but its like any jasmine code or jasmine functions just mysteriously stop working without any kind of error\r\n\r\nEventually jasmine times out with async timeout, once timed out, again, no errors are listed it just acs like done is never called.\r\n\r\nHowever if I comment out all code except for  `done` then everything works as expected."},"comment":{"url":"https://api.github.com/repos/jasmine/jasmine-npm/issues/comments/163799849","html_url":"https://github.com/jasmine/jasmine-npm/issues/62#issuecomment-163799849","issue_url":"https://api.github.com/repos/jasmine/jasmine-npm/issues/62","id":163799849,"user":{"login":"wiseguy12851","id":1305564,"avatar_url":"https://avatars.githubusercontent.com/u/1305564?v=3","gravatar_id":"","url":"https://api.github.com/users/wiseguy12851","html_url":"https://github.com/wiseguy12851","followers_url":"https://api.github.com/users/wiseguy12851/followers","following_url":"https://api.github.com/users/wiseguy12851/following{/other_user}","gists_url":"https://api.github.com/users/wiseguy12851/gists{/gist_id}","starred_url":"https://api.github.com/users/wiseguy12851/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiseguy12851/subscriptions","organizations_url":"https://api.github.com/users/wiseguy12851/orgs","repos_url":"https://api.github.com/users/wiseguy12851/repos","events_url":"https://api.github.com/users/wiseguy12851/events{/privacy}","received_events_url":"https://api.github.com/users/wiseguy12851/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T01:01:00Z","updated_at":"2015-12-11T01:01:00Z","body":"Sorry forgot to mention the version:\r\n\r\nJasmine version 2.4.1\r\nNode version 5.1.1\r\n\r\nThe project is on github and the link to the full spec file is here https://github.com/RussellsToolbox/isomorphic-cypher/blob/dev/spec/spec.js .\r\n\r\nNear the end this is the test I'm having problems with\r\n```javascript\r\nit(\"2 valid queries once\", function(done)\r\n{\r\n    this.inst.shelfQuery([{\r\n        name: \"test1\",\r\n        query: 'return \"test1\"'\r\n    },{\r\n        name: \"test2\",\r\n        query: 'return \"test2\"'\r\n    }]);\r\n\r\n    var resultObj = this.inst.unshelfQuery([\r\n        \"test1\",\r\n        \"test2\"\r\n    ]);\r\n\r\n    this.inst.unshelfQuery([\r\n        \"test1\",\r\n        \"test2\"\r\n    ]).then(function(resultObj)\r\n    {\r\n        expect(Array.isArray(resultObjs)).toEqual(true);\r\n\r\n        for(var i = 0; i < resultObjs.length; i++)\r\n        {\r\n            var resultObj = resultObjs[i];\r\n            expect(resultObj.firstValue).toEqual(\"test\" + (i+1));\r\n            expect(resultObj.queryObj.query).toEqual('return \"test' + (i+1) + '\"');\r\n        }\r\n\r\n        done();\r\n    });\r\n});\r\n```\r\n\r\nit fails with this message:\r\n\r\n```\r\n1) class unshelfQuery 2 valid queries once\r\n  Message:\r\n    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\r\n  Stack:\r\n    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\r\n        at Timer.listOnTimeout (timers.js:92:15)\r\n```\r\n\r\nAs mentioned above, all jasmine code doesn't do anything inside the promise, only non-jasmine code. The only way to get it to work is to remove all code except for done in which case it works just fine. Further example below:\r\n\r\n```javascript\r\nit(\"2 valid queries once\", function(done)\r\n{\r\n    this.inst.shelfQuery([{\r\n        name: \"test1\",\r\n        query: 'return \"test1\"'\r\n    },{\r\n        name: \"test2\",\r\n        query: 'return \"test2\"'\r\n    }]);\r\n\r\n    var resultObj = this.inst.unshelfQuery([\r\n        \"test1\",\r\n        \"test2\"\r\n    ]);\r\n\r\n    this.inst.unshelfQuery([\r\n        \"test1\",\r\n        \"test2\"\r\n    ]).then(function(resultObj)\r\n    {\r\n        // This will work as expected\r\n        done();\r\n    });\r\n});\r\n```\r\n\r\nBut having even a single line of code before done will cause the issues again. "}}