{"action":"created","issue":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/613","repository_url":"https://api.github.com/repos/jasmine/jasmine","labels_url":"https://api.github.com/repos/jasmine/jasmine/issues/613/labels{/name}","comments_url":"https://api.github.com/repos/jasmine/jasmine/issues/613/comments","events_url":"https://api.github.com/repos/jasmine/jasmine/issues/613/events","html_url":"https://github.com/jasmine/jasmine/issues/613","id":35973611,"number":613,"title":"Asynchronous tests run twice in standalone","user":{"login":"schickling","id":1567498,"avatar_url":"https://avatars.githubusercontent.com/u/1567498?v=3","gravatar_id":"","url":"https://api.github.com/users/schickling","html_url":"https://github.com/schickling","followers_url":"https://api.github.com/users/schickling/followers","following_url":"https://api.github.com/users/schickling/following{/other_user}","gists_url":"https://api.github.com/users/schickling/gists{/gist_id}","starred_url":"https://api.github.com/users/schickling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schickling/subscriptions","organizations_url":"https://api.github.com/users/schickling/orgs","repos_url":"https://api.github.com/users/schickling/repos","events_url":"https://api.github.com/users/schickling/events{/privacy}","received_events_url":"https://api.github.com/users/schickling/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jasmine/jasmine/labels/waiting","name":"waiting","color":"e102d8"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-06-18T10:54:48Z","updated_at":"2016-02-11T23:17:16Z","closed_at":"2014-12-16T23:52:33Z","body":"When running the standalone version of jasmine tests (asynchronous) run twice. The log looks something like this:\r\n\r\n```\r\nTestA starts\r\nTestA done asynchronously\r\nTestB starts\r\nTestB done asynchronously\r\nTestA starts\r\nTestA done asynchronously\r\nTestB starts\r\nTestB done asynchronously\r\nTestC starts\r\nTestC done asynchronously\r\n```\r\n\r\nAs far as I can see the tests/jasmine are not loaded twice.\r\n\r\nIt might be important to note, that I'm running the jasmine standalone version inside a Cordova application on an iOS device. I initialize the tests like the following, since I need to wait for cordova to finish loading:\r\n\r\n```js\r\nvar loadScript = function(src) {\r\n  var el = document.createElement('script')\r\n  el.setAttribute('src', src);\r\n  el.async = false;\r\n  document.body.appendChild(el);\r\n};\r\n\r\nvar loadTests = function() {\r\n  [\r\n    'lib/jasmine-2.0.0/boot.js',\r\n    'spec/myTest.js',\r\n  ].forEach(loadScript);\r\n\r\n  // timeout and window.onload needed to start tests\r\n  setTimeout(function() {\r\n    window.onload();\r\n  }, 1000);\r\n};\r\n\r\ndocument.addEventListener('deviceready', loadTests, false);\r\n```"},"comment":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/comments/183096956","html_url":"https://github.com/jasmine/jasmine/issues/613#issuecomment-183096956","issue_url":"https://api.github.com/repos/jasmine/jasmine/issues/613","id":183096956,"user":{"login":"OscarGodson","id":20615,"avatar_url":"https://avatars.githubusercontent.com/u/20615?v=3","gravatar_id":"","url":"https://api.github.com/users/OscarGodson","html_url":"https://github.com/OscarGodson","followers_url":"https://api.github.com/users/OscarGodson/followers","following_url":"https://api.github.com/users/OscarGodson/following{/other_user}","gists_url":"https://api.github.com/users/OscarGodson/gists{/gist_id}","starred_url":"https://api.github.com/users/OscarGodson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OscarGodson/subscriptions","organizations_url":"https://api.github.com/users/OscarGodson/orgs","repos_url":"https://api.github.com/users/OscarGodson/repos","events_url":"https://api.github.com/users/OscarGodson/events{/privacy}","received_events_url":"https://api.github.com/users/OscarGodson/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T23:17:16Z","updated_at":"2016-02-11T23:17:16Z","body":"Happens for me right now. I have one test:\r\n\r\n```\r\n  describe('#scrollToRow', function () {\r\n    var bgt;\r\n    beforeEach(function (done) {\r\n      console.log('==============BEFORE==============')\r\n      bgt = new BGT(defaultOpts);\r\n      bgt.addListener('rowsbuilt', function () { done(); });\r\n    });\r\n    afterEach(function () {\r\n      console.log('==============AFTER==============')\r\n      bgt.destroy();\r\n    });\r\n    it('scrolls to the row so the scrollTop is equal to the row height x index in the table', function (done) {\r\n      // Note for testing we just assume all rows are 10px (see Clusterize stub)\r\n      var els = bgt.getElements();\r\n      console.log('==============TEST==============')\r\n      expect(els.scrollArea.scrollTop).toEqual(0);\r\n\r\n      bgt.scrollToRow(2);\r\n      expect(els.scrollArea.scrollTop).toEqual(20);\r\n\r\n      bgt.updateRowDisplay(bgt.data.rows.reverse());\r\n      bgt.addListener('rowsbuilt', function () {\r\n        bgt.scrollToRow(2);\r\n        expect(els.scrollArea.scrollTop).toEqual(20);\r\n        done();\r\n      });\r\n    });\r\n  });\r\n```\r\n\r\nThe output of that is \r\n\r\n![karma debug runner 2016-02-11 15-15-15](https://cloud.githubusercontent.com/assets/20615/12993995/61b3b6cc-d0d2-11e5-8b78-0582634084b9.png)\r\n\r\nThis makes it _super_ hard to deal with because at least if it duplicated the before/afters I could clean up and the test should work, but these tests are failing because the scrollTops are altered from the previous tests.\r\n\r\n"}}