{"action":"created","issue":{"url":"https://api.github.com/repos/mochajs/mocha/issues/3578","repository_url":"https://api.github.com/repos/mochajs/mocha","labels_url":"https://api.github.com/repos/mochajs/mocha/issues/3578/labels{/name}","comments_url":"https://api.github.com/repos/mochajs/mocha/issues/3578/comments","events_url":"https://api.github.com/repos/mochajs/mocha/issues/3578/events","html_url":"https://github.com/mochajs/mocha/pull/3578","id":384102553,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMzkwNTQy","number":3578,"title":"--forbid-only now handle an empty suite marked only","user":{"login":"outsideris","id":390146,"node_id":"MDQ6VXNlcjM5MDE0Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/390146?v=4","gravatar_id":"","url":"https://api.github.com/users/outsideris","html_url":"https://github.com/outsideris","followers_url":"https://api.github.com/users/outsideris/followers","following_url":"https://api.github.com/users/outsideris/following{/other_user}","gists_url":"https://api.github.com/users/outsideris/gists{/gist_id}","starred_url":"https://api.github.com/users/outsideris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outsideris/subscriptions","organizations_url":"https://api.github.com/users/outsideris/orgs","repos_url":"https://api.github.com/users/outsideris/repos","events_url":"https://api.github.com/users/outsideris/events{/privacy}","received_events_url":"https://api.github.com/users/outsideris/received_events","type":"User","site_admin":false},"labels":[{"id":184344,"node_id":"MDU6TGFiZWwxODQzNDQ=","url":"https://api.github.com/repos/mochajs/mocha/labels/confirmed-bug","name":"confirmed-bug","color":"A6340C","default":false},{"id":533082117,"node_id":"MDU6TGFiZWw1MzMwODIxMTc=","url":"https://api.github.com/repos/mochajs/mocha/labels/semver-patch","name":"semver-patch","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-11-25T18:04:01Z","updated_at":"2018-12-05T18:35:51Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/mochajs/mocha/pulls/3578","html_url":"https://github.com/mochajs/mocha/pull/3578","diff_url":"https://github.com/mochajs/mocha/pull/3578.diff","patch_url":"https://github.com/mochajs/mocha/pull/3578.patch"},"body":"### Description of the Change\r\nAs #2944 , `--forbid-only` didn't catch an empty suite that marked as only because checking `forbidOnly` is happened in [`runTest`](https://github.com/mochajs/mocha/blob/master/lib/runner.js#L435).\r\n\r\nSo, I added `forbidOnly` check in `runSuite` when there is no greped tests and there are `_onlySuites`. To run `forbidOnly` check in `runTest`, I made new empty test here.\r\n\r\n### Alternate Designs\r\nNot delegate `runTest` for `forbidOnly`,  throw forbid error in `runSuite`?\r\n\r\n### Why should this be in core?\r\nIf there is an empty suite that marked only, tests will be passed with `--forbid-only` option.\r\n\r\n### Possible Drawbacks\r\nIf I added an empty test with no title, there is no test name in output. It looks a little bit weired. Any idea?\r\n\r\n```\r\n  nothing\r\n    1)\r\n\r\n\r\n  0 passing (3ms)\r\n  1 failing\r\n\r\n  1) nothing\r\n       :\r\n     Error: `.only` forbidden\r\n      at Runner.runTest (lib/runner.js:436:8)\r\n      at /Users/outsider/Dropbox/projects/github/mocha/lib/runner.js:568:12\r\n      at next (lib/runner.js:364:14)\r\n      at /Users/outsider/Dropbox/projects/github/mocha/lib/runner.js:374:7\r\n      at next (lib/runner.js:298:14)\r\n      at Immediate._onImmediate (lib/runner.js:342:5)\r\n```\r\n### Applicable issues\r\nclose #2944 "},"comment":{"url":"https://api.github.com/repos/mochajs/mocha/issues/comments/444593830","html_url":"https://github.com/mochajs/mocha/pull/3578#issuecomment-444593830","issue_url":"https://api.github.com/repos/mochajs/mocha/issues/3578","id":444593830,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDU5MzgzMA==","user":{"login":"boneskull","id":924465,"node_id":"MDQ6VXNlcjkyNDQ2NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/924465?v=4","gravatar_id":"","url":"https://api.github.com/users/boneskull","html_url":"https://github.com/boneskull","followers_url":"https://api.github.com/users/boneskull/followers","following_url":"https://api.github.com/users/boneskull/following{/other_user}","gists_url":"https://api.github.com/users/boneskull/gists{/gist_id}","starred_url":"https://api.github.com/users/boneskull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boneskull/subscriptions","organizations_url":"https://api.github.com/users/boneskull/orgs","repos_url":"https://api.github.com/users/boneskull/repos","events_url":"https://api.github.com/users/boneskull/events{/privacy}","received_events_url":"https://api.github.com/users/boneskull/received_events","type":"User","site_admin":false},"created_at":"2018-12-05T18:35:51Z","updated_at":"2018-12-05T18:35:51Z","author_association":"MEMBER","body":"@outsideris \tyou  may want to move the `require('chai')` in `test/reporters/base.spec.js` to the top of the file.  that might address the timeout."}}
{"actor":{"display_login":"boneskull"}}