{"action":"created","comment":{"url":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/comments/86791853","pull_request_review_id":7430757,"id":86791853,"diff_hunk":"@@ -4,25 +4,78 @@ var createPattern = function (path) {\n   return {pattern: path, included: true, served: true, watched: false}\n }\n \n-var initMocha = function (files, mochaConfig) {\n+var initMocha = function (files, config) {\n   var mochaPath = path.dirname(require.resolve('mocha'))\n   files.unshift(createPattern(path.join(__dirname, 'adapter.js')))\n \n-  if (mochaConfig && mochaConfig.require && mochaConfig.require.map) {\n+  config = config || {}\n+  config.client = config.client || {}\n+  var mochaConfig = config.client.mocha = getMochaOpts(config.client.mocha || {})\n+\n+  if (mochaConfig.require && mochaConfig.require.map) {\n     mochaConfig.require.map(function (requirePath) {\n       return files.unshift(createPattern(requirePath))\n     })\n   }\n \n   files.unshift(createPattern(path.join(mochaPath, 'mocha.js')))\n \n-  if (mochaConfig && mochaConfig.reporter) {\n+  if (mochaConfig.reporter) {\n     files.unshift(createPattern(path.join(mochaPath, 'mocha.css')))\n   }\n }\n \n-initMocha.$inject = ['config.files', 'config.client.mocha']\n+initMocha.$inject = ['config.files', 'config']\n \n module.exports = {\n   'framework:mocha': ['factory', initMocha]\n }\n+\n+function getMochaOpts (mochaConfig) {\n+  var optsPath = typeof mochaConfig.opts === 'string' ? mochaConfig.opts : 'test/mocha.opts'\n+\n+  if (!mochaConfig.opts) {\n+    return mochaConfig\n+  }\n+\n+  delete mochaConfig.opts\n+\n+  var fs = require('fs')\n+  if (!fs.existsSync(optsPath)) {\n+    return mochaConfig\n+  }\n+\n+  var extend = require('util')._extend\n+  return extend(normalizeOpts(require('minimist')(fs.readFileSync(optsPath, 'utf8')\n+    .replace(/\\\\\\s/g, '%20')\n+    .split(/\\s/)\n+    .filter(Boolean)\n+    .map(function (value) {\n+      return value.replace(/%20/g, ' ')\n+    }))), mochaConfig)\n+\n+  function normalizeOpts (opts) {\n+    opts = [\n+      'require',\n+","path":"lib/index.js","position":61,"original_position":61,"commit_id":"cb4662339e7847d014eac895f5987935314faa85","original_commit_id":"cb4662339e7847d014eac895f5987935314faa85","user":{"login":"maksimr","id":616193,"avatar_url":"https://avatars.githubusercontent.com/u/616193?v=3","gravatar_id":"","url":"https://api.github.com/users/maksimr","html_url":"https://github.com/maksimr","followers_url":"https://api.github.com/users/maksimr/followers","following_url":"https://api.github.com/users/maksimr/following{/other_user}","gists_url":"https://api.github.com/users/maksimr/gists{/gist_id}","starred_url":"https://api.github.com/users/maksimr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksimr/subscriptions","organizations_url":"https://api.github.com/users/maksimr/orgs","repos_url":"https://api.github.com/users/maksimr/repos","events_url":"https://api.github.com/users/maksimr/events{/privacy}","received_events_url":"https://api.github.com/users/maksimr/received_events","type":"User","site_admin":false},"body":"@dignifiedquire This line separte options which will pass to mocha in browser from options which use only on the server (like require) and not acceptable in browser","created_at":"2016-11-07T15:00:29Z","updated_at":"2016-11-07T15:00:29Z","html_url":"https://github.com/karma-runner/karma-mocha/pull/121#discussion_r86791853","pull_request_url":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/121","_links":{"self":{"href":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/comments/86791853"},"html":{"href":"https://github.com/karma-runner/karma-mocha/pull/121#discussion_r86791853"},"pull_request":{"href":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/121"}}},"pull_request":{"url":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/121","id":92463889,"html_url":"https://github.com/karma-runner/karma-mocha/pull/121","diff_url":"https://github.com/karma-runner/karma-mocha/pull/121.diff","patch_url":"https://github.com/karma-runner/karma-mocha/pull/121.patch","issue_url":"https://api.github.com/repos/karma-runner/karma-mocha/issues/121","number":121,"state":"open","locked":false,"title":"feat: support mocha opts","user":{"login":"maksimr","id":616193,"avatar_url":"https://avatars.githubusercontent.com/u/616193?v=3","gravatar_id":"","url":"https://api.github.com/users/maksimr","html_url":"https://github.com/maksimr","followers_url":"https://api.github.com/users/maksimr/followers","following_url":"https://api.github.com/users/maksimr/following{/other_user}","gists_url":"https://api.github.com/users/maksimr/gists{/gist_id}","starred_url":"https://api.github.com/users/maksimr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksimr/subscriptions","organizations_url":"https://api.github.com/users/maksimr/orgs","repos_url":"https://api.github.com/users/maksimr/repos","events_url":"https://api.github.com/users/maksimr/events{/privacy}","received_events_url":"https://api.github.com/users/maksimr/received_events","type":"User","site_admin":false},"body":"closes #99","created_at":"2016-11-05T19:16:47Z","updated_at":"2016-11-07T15:00:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f13c515a7d27c33b5b4a0302fe5bff2f89ec10d","assignee":{"login":"dignifiedquire","id":790842,"avatar_url":"https://avatars.githubusercontent.com/u/790842?v=3","gravatar_id":"","url":"https://api.github.com/users/dignifiedquire","html_url":"https://github.com/dignifiedquire","followers_url":"https://api.github.com/users/dignifiedquire/followers","following_url":"https://api.github.com/users/dignifiedquire/following{/other_user}","gists_url":"https://api.github.com/users/dignifiedquire/gists{/gist_id}","starred_url":"https://api.github.com/users/dignifiedquire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dignifiedquire/subscriptions","organizations_url":"https://api.github.com/users/dignifiedquire/orgs","repos_url":"https://api.github.com/users/dignifiedquire/repos","events_url":"https://api.github.com/users/dignifiedquire/events{/privacy}","received_events_url":"https://api.github.com/users/dignifiedquire/received_events","type":"User","site_admin":false},"assignees":[{"login":"dignifiedquire","id":790842,"avatar_url":"https://avatars.githubusercontent.com/u/790842?v=3","gravatar_id":"","url":"https://api.github.com/users/dignifiedquire","html_url":"https://github.com/dignifiedquire","followers_url":"https://api.github.com/users/dignifiedquire/followers","following_url":"https://api.github.com/users/dignifiedquire/following{/other_user}","gists_url":"https://api.github.com/users/dignifiedquire/gists{/gist_id}","starred_url":"https://api.github.com/users/dignifiedquire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dignifiedquire/subscriptions","organizations_url":"https://api.github.com/users/dignifiedquire/orgs","repos_url":"https://api.github.com/users/dignifiedquire/repos","events_url":"https://api.github.com/users/dignifiedquire/events{/privacy}","received_events_url":"https://api.github.com/users/dignifiedquire/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/121/commits","review_comments_url":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/121/comments","review_comment_url":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/comments{/number}","comments_url":"https://api.github.com/repos/karma-runner/karma-mocha/issues/121/comments","statuses_url":"https://api.github.com/repos/karma-runner/karma-mocha/statuses/cb4662339e7847d014eac895f5987935314faa85","head":{"label":"maksimr:mocha-opts","ref":"mocha-opts","sha":"cb4662339e7847d014eac895f5987935314faa85","user":{"login":"maksimr","id":616193,"avatar_url":"https://avatars.githubusercontent.com/u/616193?v=3","gravatar_id":"","url":"https://api.github.com/users/maksimr","html_url":"https://github.com/maksimr","followers_url":"https://api.github.com/users/maksimr/followers","following_url":"https://api.github.com/users/maksimr/following{/other_user}","gists_url":"https://api.github.com/users/maksimr/gists{/gist_id}","starred_url":"https://api.github.com/users/maksimr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksimr/subscriptions","organizations_url":"https://api.github.com/users/maksimr/orgs","repos_url":"https://api.github.com/users/maksimr/repos","events_url":"https://api.github.com/users/maksimr/events{/privacy}","received_events_url":"https://api.github.com/users/maksimr/received_events","type":"User","site_admin":false},"repo":{"id":16862567,"name":"karma-mocha","full_name":"maksimr/karma-mocha","owner":{"login":"maksimr","id":616193,"avatar_url":"https://avatars.githubusercontent.com/u/616193?v=3","gravatar_id":"","url":"https://api.github.com/users/maksimr","html_url":"https://github.com/maksimr","followers_url":"https://api.github.com/users/maksimr/followers","following_url":"https://api.github.com/users/maksimr/following{/other_user}","gists_url":"https://api.github.com/users/maksimr/gists{/gist_id}","starred_url":"https://api.github.com/users/maksimr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksimr/subscriptions","organizations_url":"https://api.github.com/users/maksimr/orgs","repos_url":"https://api.github.com/users/maksimr/repos","events_url":"https://api.github.com/users/maksimr/events{/privacy}","received_events_url":"https://api.github.com/users/maksimr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maksimr/karma-mocha","description":"A Karma plugin. Adapter for Mocha testing framework.","fork":true,"url":"https://api.github.com/repos/maksimr/karma-mocha","forks_url":"https://api.github.com/repos/maksimr/karma-mocha/forks","keys_url":"https://api.github.com/repos/maksimr/karma-mocha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maksimr/karma-mocha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maksimr/karma-mocha/teams","hooks_url":"https://api.github.com/repos/maksimr/karma-mocha/hooks","issue_events_url":"https://api.github.com/repos/maksimr/karma-mocha/issues/events{/number}","events_url":"https://api.github.com/repos/maksimr/karma-mocha/events","assignees_url":"https://api.github.com/repos/maksimr/karma-mocha/assignees{/user}","branches_url":"https://api.github.com/repos/maksimr/karma-mocha/branches{/branch}","tags_url":"https://api.github.com/repos/maksimr/karma-mocha/tags","blobs_url":"https://api.github.com/repos/maksimr/karma-mocha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maksimr/karma-mocha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maksimr/karma-mocha/git/refs{/sha}","trees_url":"https://api.github.com/repos/maksimr/karma-mocha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maksimr/karma-mocha/statuses/{sha}","languages_url":"https://api.github.com/repos/maksimr/karma-mocha/languages","stargazers_url":"https://api.github.com/repos/maksimr/karma-mocha/stargazers","contributors_url":"https://api.github.com/repos/maksimr/karma-mocha/contributors","subscribers_url":"https://api.github.com/repos/maksimr/karma-mocha/subscribers","subscription_url":"https://api.github.com/repos/maksimr/karma-mocha/subscription","commits_url":"https://api.github.com/repos/maksimr/karma-mocha/commits{/sha}","git_commits_url":"https://api.github.com/repos/maksimr/karma-mocha/git/commits{/sha}","comments_url":"https://api.github.com/repos/maksimr/karma-mocha/comments{/number}","issue_comment_url":"https://api.github.com/repos/maksimr/karma-mocha/issues/comments{/number}","contents_url":"https://api.github.com/repos/maksimr/karma-mocha/contents/{+path}","compare_url":"https://api.github.com/repos/maksimr/karma-mocha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maksimr/karma-mocha/merges","archive_url":"https://api.github.com/repos/maksimr/karma-mocha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maksimr/karma-mocha/downloads","issues_url":"https://api.github.com/repos/maksimr/karma-mocha/issues{/number}","pulls_url":"https://api.github.com/repos/maksimr/karma-mocha/pulls{/number}","milestones_url":"https://api.github.com/repos/maksimr/karma-mocha/milestones{/number}","notifications_url":"https://api.github.com/repos/maksimr/karma-mocha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maksimr/karma-mocha/labels{/name}","releases_url":"https://api.github.com/repos/maksimr/karma-mocha/releases{/id}","deployments_url":"https://api.github.com/repos/maksimr/karma-mocha/deployments","created_at":"2014-02-15T12:41:52Z","updated_at":"2014-08-03T22:31:37Z","pushed_at":"2016-11-05T19:15:35Z","git_url":"git://github.com/maksimr/karma-mocha.git","ssh_url":"git@github.com:maksimr/karma-mocha.git","clone_url":"https://github.com/maksimr/karma-mocha.git","svn_url":"https://github.com/maksimr/karma-mocha","homepage":"","size":136,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"karma-runner:master","ref":"master","sha":"e8ff71f3712738c88788577de756d57f508debd5","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":8484967,"name":"karma-mocha","full_name":"karma-runner/karma-mocha","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-mocha","description":"A Karma plugin. Adapter for Mocha testing framework.","fork":false,"url":"https://api.github.com/repos/karma-runner/karma-mocha","forks_url":"https://api.github.com/repos/karma-runner/karma-mocha/forks","keys_url":"https://api.github.com/repos/karma-runner/karma-mocha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/karma-runner/karma-mocha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/karma-runner/karma-mocha/teams","hooks_url":"https://api.github.com/repos/karma-runner/karma-mocha/hooks","issue_events_url":"https://api.github.com/repos/karma-runner/karma-mocha/issues/events{/number}","events_url":"https://api.github.com/repos/karma-runner/karma-mocha/events","assignees_url":"https://api.github.com/repos/karma-runner/karma-mocha/assignees{/user}","branches_url":"https://api.github.com/repos/karma-runner/karma-mocha/branches{/branch}","tags_url":"https://api.github.com/repos/karma-runner/karma-mocha/tags","blobs_url":"https://api.github.com/repos/karma-runner/karma-mocha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/karma-runner/karma-mocha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/karma-runner/karma-mocha/git/refs{/sha}","trees_url":"https://api.github.com/repos/karma-runner/karma-mocha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/karma-runner/karma-mocha/statuses/{sha}","languages_url":"https://api.github.com/repos/karma-runner/karma-mocha/languages","stargazers_url":"https://api.github.com/repos/karma-runner/karma-mocha/stargazers","contributors_url":"https://api.github.com/repos/karma-runner/karma-mocha/contributors","subscribers_url":"https://api.github.com/repos/karma-runner/karma-mocha/subscribers","subscription_url":"https://api.github.com/repos/karma-runner/karma-mocha/subscription","commits_url":"https://api.github.com/repos/karma-runner/karma-mocha/commits{/sha}","git_commits_url":"https://api.github.com/repos/karma-runner/karma-mocha/git/commits{/sha}","comments_url":"https://api.github.com/repos/karma-runner/karma-mocha/comments{/number}","issue_comment_url":"https://api.github.com/repos/karma-runner/karma-mocha/issues/comments{/number}","contents_url":"https://api.github.com/repos/karma-runner/karma-mocha/contents/{+path}","compare_url":"https://api.github.com/repos/karma-runner/karma-mocha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/karma-runner/karma-mocha/merges","archive_url":"https://api.github.com/repos/karma-runner/karma-mocha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/karma-runner/karma-mocha/downloads","issues_url":"https://api.github.com/repos/karma-runner/karma-mocha/issues{/number}","pulls_url":"https://api.github.com/repos/karma-runner/karma-mocha/pulls{/number}","milestones_url":"https://api.github.com/repos/karma-runner/karma-mocha/milestones{/number}","notifications_url":"https://api.github.com/repos/karma-runner/karma-mocha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/karma-runner/karma-mocha/labels{/name}","releases_url":"https://api.github.com/repos/karma-runner/karma-mocha/releases{/id}","deployments_url":"https://api.github.com/repos/karma-runner/karma-mocha/deployments","created_at":"2013-02-28T18:19:34Z","updated_at":"2016-11-02T17:20:55Z","pushed_at":"2016-11-05T19:16:47Z","git_url":"git://github.com/karma-runner/karma-mocha.git","ssh_url":"git@github.com:karma-runner/karma-mocha.git","clone_url":"https://github.com/karma-runner/karma-mocha.git","svn_url":"https://github.com/karma-runner/karma-mocha","homepage":"","size":163,"stargazers_count":232,"watchers_count":232,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":68,"mirror_url":null,"open_issues_count":11,"forks":68,"open_issues":11,"watchers":232,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/121"},"html":{"href":"https://github.com/karma-runner/karma-mocha/pull/121"},"issue":{"href":"https://api.github.com/repos/karma-runner/karma-mocha/issues/121"},"comments":{"href":"https://api.github.com/repos/karma-runner/karma-mocha/issues/121/comments"},"review_comments":{"href":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/121/comments"},"review_comment":{"href":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/karma-runner/karma-mocha/pulls/121/commits"},"statuses":{"href":"https://api.github.com/repos/karma-runner/karma-mocha/statuses/cb4662339e7847d014eac895f5987935314faa85"}}}}
{"actor":{"display_login":"maksimr"}}