{"action":"opened","number":2127,"pull_request":{"url":"https://api.github.com/repos/karma-runner/karma/pulls/2127","id":69464913,"html_url":"https://github.com/karma-runner/karma/pull/2127","diff_url":"https://github.com/karma-runner/karma/pull/2127.diff","patch_url":"https://github.com/karma-runner/karma/pull/2127.patch","issue_url":"https://api.github.com/repos/karma-runner/karma/issues/2127","number":2127,"state":"open","locked":false,"title":"Allow browserDisconnectTolerance to be set in non-singleRun mode.","user":{"login":"dtinth","id":193136,"avatar_url":"https://avatars.githubusercontent.com/u/193136?v=3","gravatar_id":"","url":"https://api.github.com/users/dtinth","html_url":"https://github.com/dtinth","followers_url":"https://api.github.com/users/dtinth/followers","following_url":"https://api.github.com/users/dtinth/following{/other_user}","gists_url":"https://api.github.com/users/dtinth/gists{/gist_id}","starred_url":"https://api.github.com/users/dtinth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtinth/subscriptions","organizations_url":"https://api.github.com/users/dtinth/orgs","repos_url":"https://api.github.com/users/dtinth/repos","events_url":"https://api.github.com/users/dtinth/events{/privacy}","received_events_url":"https://api.github.com/users/dtinth/received_events","type":"User","site_admin":false},"body":"We’re encountering a problem where sometimes Karma just disconnects and stops running tests until we restart Karma manually.\r\n\r\nWe found that some of our JavaScript code intermittently gets stuck when running tests — that Karma considers it a time out. One such example is an infinite loop in the code.\r\n\r\nLooking at other issues (https://github.com/karma-runner/karma/issues/598, https://github.com/karma-runner/karma/issues/1514) suggests adding `browserDisconnectTolerance`. I’ve tried that and several other options to no avail.\r\n\r\nFrom further source code inspection, in 19590e1f66fd6c3b0d3fc9e90000c705198e0e70 it turns out that __`browserDisconnectTolerance` is only active in `singleRun` mode.__ This pull request makes `browserDisconnectTolerance` work in non-singleRun mode.\r\n\r\n## Test case\r\n\r\nHere’s a test case to verify that my patch works:\r\n\r\n### test.js\r\n\r\nThis test will get stuck in an infinite loop with 75% chance.\r\n\r\n```js\r\ndescribe('example', function () {\r\n  it('ok1', function () { })\r\n  it('ok2', function () { })\r\n  it('bad1', function () {\r\n    if (Math.random() > 0.5) for (;;) ;\r\n  })\r\n  it('bad2', function () {\r\n    if (Math.random() > 0.5) for (;;) ;\r\n  })\r\n  it('ok3', function () { })\r\n})\r\n```\r\n\r\n### karma.conf.js\r\n\r\nSets a ridiculously high amount of retries.\r\n\r\n```js\r\nmodule.exports = function (config) {\r\n  config.set({\r\n    basePath: '',\r\n    frameworks: ['mocha'],\r\n    files: [\r\n      'test.js'\r\n    ],\r\n    reporters: [ 'progress' ],\r\n    port: 9988,\r\n    colors: true,\r\n    logLevel: config.LOG_INFO,\r\n    autoWatch: true,\r\n    browsers: [ 'PhantomJS' ],\r\n    browserDisconnectTolerance: 99999999999999999999999999999999999999999999999,\r\n    retryLimit: 999999999999999999999999999999999999999999999999999999999999999,\r\n    plugins: [\r\n      'karma-mocha',\r\n      'karma-phantomjs-launcher',\r\n    ],\r\n    singleRun: false,\r\n  })\r\n}\r\n```\r\n","created_at":"2016-05-10T08:13:14Z","updated_at":"2016-05-10T08:13:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/karma-runner/karma/pulls/2127/commits","review_comments_url":"https://api.github.com/repos/karma-runner/karma/pulls/2127/comments","review_comment_url":"https://api.github.com/repos/karma-runner/karma/pulls/comments{/number}","comments_url":"https://api.github.com/repos/karma-runner/karma/issues/2127/comments","statuses_url":"https://api.github.com/repos/karma-runner/karma/statuses/9c281ea959036c960393366e47d13dbd67fe855a","head":{"label":"taskworld:feature-allow-browserDisconnectTolerance-to-be-set-in-non-singleRun-mode","ref":"feature-allow-browserDisconnectTolerance-to-be-set-in-non-singleRun-mode","sha":"9c281ea959036c960393366e47d13dbd67fe855a","user":{"login":"taskworld","id":4669243,"avatar_url":"https://avatars.githubusercontent.com/u/4669243?v=3","gravatar_id":"","url":"https://api.github.com/users/taskworld","html_url":"https://github.com/taskworld","followers_url":"https://api.github.com/users/taskworld/followers","following_url":"https://api.github.com/users/taskworld/following{/other_user}","gists_url":"https://api.github.com/users/taskworld/gists{/gist_id}","starred_url":"https://api.github.com/users/taskworld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskworld/subscriptions","organizations_url":"https://api.github.com/users/taskworld/orgs","repos_url":"https://api.github.com/users/taskworld/repos","events_url":"https://api.github.com/users/taskworld/events{/privacy}","received_events_url":"https://api.github.com/users/taskworld/received_events","type":"Organization","site_admin":false},"repo":{"id":58441104,"name":"karma","full_name":"taskworld/karma","owner":{"login":"taskworld","id":4669243,"avatar_url":"https://avatars.githubusercontent.com/u/4669243?v=3","gravatar_id":"","url":"https://api.github.com/users/taskworld","html_url":"https://github.com/taskworld","followers_url":"https://api.github.com/users/taskworld/followers","following_url":"https://api.github.com/users/taskworld/following{/other_user}","gists_url":"https://api.github.com/users/taskworld/gists{/gist_id}","starred_url":"https://api.github.com/users/taskworld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskworld/subscriptions","organizations_url":"https://api.github.com/users/taskworld/orgs","repos_url":"https://api.github.com/users/taskworld/repos","events_url":"https://api.github.com/users/taskworld/events{/privacy}","received_events_url":"https://api.github.com/users/taskworld/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/taskworld/karma","description":"Spectacular Test Runner for JavaScript","fork":true,"url":"https://api.github.com/repos/taskworld/karma","forks_url":"https://api.github.com/repos/taskworld/karma/forks","keys_url":"https://api.github.com/repos/taskworld/karma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/taskworld/karma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/taskworld/karma/teams","hooks_url":"https://api.github.com/repos/taskworld/karma/hooks","issue_events_url":"https://api.github.com/repos/taskworld/karma/issues/events{/number}","events_url":"https://api.github.com/repos/taskworld/karma/events","assignees_url":"https://api.github.com/repos/taskworld/karma/assignees{/user}","branches_url":"https://api.github.com/repos/taskworld/karma/branches{/branch}","tags_url":"https://api.github.com/repos/taskworld/karma/tags","blobs_url":"https://api.github.com/repos/taskworld/karma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/taskworld/karma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/taskworld/karma/git/refs{/sha}","trees_url":"https://api.github.com/repos/taskworld/karma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/taskworld/karma/statuses/{sha}","languages_url":"https://api.github.com/repos/taskworld/karma/languages","stargazers_url":"https://api.github.com/repos/taskworld/karma/stargazers","contributors_url":"https://api.github.com/repos/taskworld/karma/contributors","subscribers_url":"https://api.github.com/repos/taskworld/karma/subscribers","subscription_url":"https://api.github.com/repos/taskworld/karma/subscription","commits_url":"https://api.github.com/repos/taskworld/karma/commits{/sha}","git_commits_url":"https://api.github.com/repos/taskworld/karma/git/commits{/sha}","comments_url":"https://api.github.com/repos/taskworld/karma/comments{/number}","issue_comment_url":"https://api.github.com/repos/taskworld/karma/issues/comments{/number}","contents_url":"https://api.github.com/repos/taskworld/karma/contents/{+path}","compare_url":"https://api.github.com/repos/taskworld/karma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/taskworld/karma/merges","archive_url":"https://api.github.com/repos/taskworld/karma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/taskworld/karma/downloads","issues_url":"https://api.github.com/repos/taskworld/karma/issues{/number}","pulls_url":"https://api.github.com/repos/taskworld/karma/pulls{/number}","milestones_url":"https://api.github.com/repos/taskworld/karma/milestones{/number}","notifications_url":"https://api.github.com/repos/taskworld/karma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/taskworld/karma/labels{/name}","releases_url":"https://api.github.com/repos/taskworld/karma/releases{/id}","deployments_url":"https://api.github.com/repos/taskworld/karma/deployments","created_at":"2016-05-10T07:58:18Z","updated_at":"2016-05-10T07:58:20Z","pushed_at":"2016-05-10T08:02:07Z","git_url":"git://github.com/taskworld/karma.git","ssh_url":"git@github.com:taskworld/karma.git","clone_url":"https://github.com/taskworld/karma.git","svn_url":"https://github.com/taskworld/karma","homepage":"http://karma-runner.github.io","size":6848,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"karma-runner:master","ref":"master","sha":"2d51260f06308a7a66acff0c60cdf51636d33e7d","user":{"login":"karma-runner","id":3284117,"avatar_url":"https://avatars.githubusercontent.com/u/3284117?v=3","gravatar_id":"","url":"https://api.github.com/users/karma-runner","html_url":"https://github.com/karma-runner","followers_url":"https://api.github.com/users/karma-runner/followers","following_url":"https://api.github.com/users/karma-runner/following{/other_user}","gists_url":"https://api.github.com/users/karma-runner/gists{/gist_id}","starred_url":"https://api.github.com/users/karma-runner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karma-runner/subscriptions","organizations_url":"https://api.github.com/users/karma-runner/orgs","repos_url":"https://api.github.com/users/karma-runner/repos","events_url":"https://api.github.com/users/karma-runner/events{/privacy}","received_events_url":"https://api.github.com/users/karma-runner/received_events","type":"Organization","site_admin":false},"repo":{"id":2560988,"name":"karma","full_name":"karma-runner/karma","owner":{"login":"karma-runner","id":3284117,"avatar_url":"https://avatars.githubusercontent.com/u/3284117?v=3","gravatar_id":"","url":"https://api.github.com/users/karma-runner","html_url":"https://github.com/karma-runner","followers_url":"https://api.github.com/users/karma-runner/followers","following_url":"https://api.github.com/users/karma-runner/following{/other_user}","gists_url":"https://api.github.com/users/karma-runner/gists{/gist_id}","starred_url":"https://api.github.com/users/karma-runner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karma-runner/subscriptions","organizations_url":"https://api.github.com/users/karma-runner/orgs","repos_url":"https://api.github.com/users/karma-runner/repos","events_url":"https://api.github.com/users/karma-runner/events{/privacy}","received_events_url":"https://api.github.com/users/karma-runner/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/karma-runner/karma","description":"Spectacular Test Runner for JavaScript","fork":false,"url":"https://api.github.com/repos/karma-runner/karma","forks_url":"https://api.github.com/repos/karma-runner/karma/forks","keys_url":"https://api.github.com/repos/karma-runner/karma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/karma-runner/karma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/karma-runner/karma/teams","hooks_url":"https://api.github.com/repos/karma-runner/karma/hooks","issue_events_url":"https://api.github.com/repos/karma-runner/karma/issues/events{/number}","events_url":"https://api.github.com/repos/karma-runner/karma/events","assignees_url":"https://api.github.com/repos/karma-runner/karma/assignees{/user}","branches_url":"https://api.github.com/repos/karma-runner/karma/branches{/branch}","tags_url":"https://api.github.com/repos/karma-runner/karma/tags","blobs_url":"https://api.github.com/repos/karma-runner/karma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/karma-runner/karma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/karma-runner/karma/git/refs{/sha}","trees_url":"https://api.github.com/repos/karma-runner/karma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/karma-runner/karma/statuses/{sha}","languages_url":"https://api.github.com/repos/karma-runner/karma/languages","stargazers_url":"https://api.github.com/repos/karma-runner/karma/stargazers","contributors_url":"https://api.github.com/repos/karma-runner/karma/contributors","subscribers_url":"https://api.github.com/repos/karma-runner/karma/subscribers","subscription_url":"https://api.github.com/repos/karma-runner/karma/subscription","commits_url":"https://api.github.com/repos/karma-runner/karma/commits{/sha}","git_commits_url":"https://api.github.com/repos/karma-runner/karma/git/commits{/sha}","comments_url":"https://api.github.com/repos/karma-runner/karma/comments{/number}","issue_comment_url":"https://api.github.com/repos/karma-runner/karma/issues/comments{/number}","contents_url":"https://api.github.com/repos/karma-runner/karma/contents/{+path}","compare_url":"https://api.github.com/repos/karma-runner/karma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/karma-runner/karma/merges","archive_url":"https://api.github.com/repos/karma-runner/karma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/karma-runner/karma/downloads","issues_url":"https://api.github.com/repos/karma-runner/karma/issues{/number}","pulls_url":"https://api.github.com/repos/karma-runner/karma/pulls{/number}","milestones_url":"https://api.github.com/repos/karma-runner/karma/milestones{/number}","notifications_url":"https://api.github.com/repos/karma-runner/karma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/karma-runner/karma/labels{/name}","releases_url":"https://api.github.com/repos/karma-runner/karma/releases{/id}","deployments_url":"https://api.github.com/repos/karma-runner/karma/deployments","created_at":"2011-10-12T07:55:46Z","updated_at":"2016-05-10T07:19:35Z","pushed_at":"2016-05-10T03:33:22Z","git_url":"git://github.com/karma-runner/karma.git","ssh_url":"git@github.com:karma-runner/karma.git","clone_url":"https://github.com/karma-runner/karma.git","svn_url":"https://github.com/karma-runner/karma","homepage":"http://karma-runner.github.io","size":9927,"stargazers_count":6913,"watchers_count":6913,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1098,"mirror_url":null,"open_issues_count":262,"forks":1098,"open_issues":262,"watchers":6913,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/karma-runner/karma/pulls/2127"},"html":{"href":"https://github.com/karma-runner/karma/pull/2127"},"issue":{"href":"https://api.github.com/repos/karma-runner/karma/issues/2127"},"comments":{"href":"https://api.github.com/repos/karma-runner/karma/issues/2127/comments"},"review_comments":{"href":"https://api.github.com/repos/karma-runner/karma/pulls/2127/comments"},"review_comment":{"href":"https://api.github.com/repos/karma-runner/karma/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/karma-runner/karma/pulls/2127/commits"},"statuses":{"href":"https://api.github.com/repos/karma-runner/karma/statuses/9c281ea959036c960393366e47d13dbd67fe855a"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":25,"deletions":22,"changed_files":2}}