{"action":"created","issue":{"url":"https://api.github.com/repos/theintern/intern/issues/514","repository_url":"https://api.github.com/repos/theintern/intern","labels_url":"https://api.github.com/repos/theintern/intern/issues/514/labels{/name}","comments_url":"https://api.github.com/repos/theintern/intern/issues/514/comments","events_url":"https://api.github.com/repos/theintern/intern/issues/514/events","html_url":"https://github.com/theintern/intern/issues/514","id":109670400,"number":514,"title":"Feature: suite.only() and test.only()","user":{"login":"sholladay","id":3674950,"avatar_url":"https://avatars.githubusercontent.com/u/3674950?v=3","gravatar_id":"","url":"https://api.github.com/users/sholladay","html_url":"https://github.com/sholladay","followers_url":"https://api.github.com/users/sholladay/followers","following_url":"https://api.github.com/users/sholladay/following{/other_user}","gists_url":"https://api.github.com/users/sholladay/gists{/gist_id}","starred_url":"https://api.github.com/users/sholladay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sholladay/subscriptions","organizations_url":"https://api.github.com/users/sholladay/orgs","repos_url":"https://api.github.com/users/sholladay/repos","events_url":"https://api.github.com/users/sholladay/events{/privacy}","received_events_url":"https://api.github.com/users/sholladay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/theintern/intern/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2015-10-04T08:56:01Z","updated_at":"2016-09-13T22:13:54Z","closed_at":null,"body":"### Problem\r\n\r\nYou are in the middle of debugging a test or suite. You want to isolate the specific one you are working on and only run it, so you can see the results of your hacking as soon as possible. You could use `grep`, but that involves thinking about regex, escape sequences (particularly on the command line), and depends upon consistent and well structured suite and test names. It would be great if you could just type a few simple characters in the file you are already working in and re-run with the same command you always have been. This would also make it easier to use Intern with `watch` tasks, without changing the configuration for that, too.\r\n\r\n### Solution\r\n\r\nSupport a runtime method like `suite.only()` and `test.only()` that instructs the test system that normal suites/tests should be skipped - or, in other words, inverts the implicit run-by-default relationship.\r\n\r\nRelevant API in mocha: http://jaketrent.com/post/run-single-mocha-test/\r\n\r\n**Example**:\r\n\r\nThis file with a troublesome \"b\" test:\r\n\r\n```js\r\ndefine(\r\n    [\r\n        'intern!tdd'\r\n    ],\r\n    (tdd) => {\r\n        const { suite, test } = tdd;\r\n        suite('mySuite', function () {\r\n            test('a', function () {\r\n            });\r\n            test('b', function () {\r\n                // ... bugs ...\r\n            });\r\n            test('c', function () {\r\n            });\r\n        });\r\n    }\r\n);\r\n```\r\n... could be modified to ...\r\n\r\n```js\r\ndefine(\r\n    [\r\n        'intern!tdd'\r\n    ],\r\n    (tdd) => {\r\n        const { suite, test } = tdd;\r\n        suite('mySuite', function () {\r\n            test('a', function () {\r\n            });\r\n            test.only('b', function () {\r\n                // ... bugs ...\r\n            });\r\n            test('c', function () {\r\n            });\r\n        });\r\n    }\r\n);\r\n```\r\n\r\nIdeally, this would skip tests that were registered outside of suite \"a\". But if also adding .only() to parent suites were necessary to achieve this, that would still be reasonable.\r\n\r\n**Stretch goals:**\r\n - If multiple tests use .only() then all of those, but only those, are run."},"comment":{"url":"https://api.github.com/repos/theintern/intern/issues/comments/246842681","html_url":"https://github.com/theintern/intern/issues/514#issuecomment-246842681","issue_url":"https://api.github.com/repos/theintern/intern/issues/514","id":246842681,"user":{"login":"bricejlin","id":4443267,"avatar_url":"https://avatars.githubusercontent.com/u/4443267?v=3","gravatar_id":"","url":"https://api.github.com/users/bricejlin","html_url":"https://github.com/bricejlin","followers_url":"https://api.github.com/users/bricejlin/followers","following_url":"https://api.github.com/users/bricejlin/following{/other_user}","gists_url":"https://api.github.com/users/bricejlin/gists{/gist_id}","starred_url":"https://api.github.com/users/bricejlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bricejlin/subscriptions","organizations_url":"https://api.github.com/users/bricejlin/orgs","repos_url":"https://api.github.com/users/bricejlin/repos","events_url":"https://api.github.com/users/bricejlin/events{/privacy}","received_events_url":"https://api.github.com/users/bricejlin/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T22:13:53Z","updated_at":"2016-09-13T22:13:53Z","body":"@sholladay hrm, no I haven't used the CLI before. I guess that's another way to single out tests?"}}
{"actor":{"display_login":"bricejlin"}}