{"action":"created","issue":{"url":"https://api.github.com/repos/sinonjs/commons/issues/11","repository_url":"https://api.github.com/repos/sinonjs/commons","labels_url":"https://api.github.com/repos/sinonjs/commons/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/sinonjs/commons/issues/11/comments","events_url":"https://api.github.com/repos/sinonjs/commons/issues/11/events","html_url":"https://github.com/sinonjs/commons/issues/11","id":375151614,"node_id":"MDU6SXNzdWUzNzUxNTE2MTQ=","number":11,"title":"Question: Why forgo the test directory?","user":{"login":"fearphage","id":23887,"node_id":"MDQ6VXNlcjIzODg3","avatar_url":"https://avatars1.githubusercontent.com/u/23887?v=4","gravatar_id":"","url":"https://api.github.com/users/fearphage","html_url":"https://github.com/fearphage","followers_url":"https://api.github.com/users/fearphage/followers","following_url":"https://api.github.com/users/fearphage/following{/other_user}","gists_url":"https://api.github.com/users/fearphage/gists{/gist_id}","starred_url":"https://api.github.com/users/fearphage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fearphage/subscriptions","organizations_url":"https://api.github.com/users/fearphage/orgs","repos_url":"https://api.github.com/users/fearphage/repos","events_url":"https://api.github.com/users/fearphage/events{/privacy}","received_events_url":"https://api.github.com/users/fearphage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-29T18:16:35Z","updated_at":"2018-10-29T21:04:52Z","closed_at":null,"author_association":"MEMBER","body":"Just curious why or if there are benefits to this way or downsides to the other? That is all."},"comment":{"url":"https://api.github.com/repos/sinonjs/commons/issues/comments/434079578","html_url":"https://github.com/sinonjs/commons/issues/11#issuecomment-434079578","issue_url":"https://api.github.com/repos/sinonjs/commons/issues/11","id":434079578,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDA3OTU3OA==","user":{"login":"mroderick","id":20321,"node_id":"MDQ6VXNlcjIwMzIx","avatar_url":"https://avatars2.githubusercontent.com/u/20321?v=4","gravatar_id":"","url":"https://api.github.com/users/mroderick","html_url":"https://github.com/mroderick","followers_url":"https://api.github.com/users/mroderick/followers","following_url":"https://api.github.com/users/mroderick/following{/other_user}","gists_url":"https://api.github.com/users/mroderick/gists{/gist_id}","starred_url":"https://api.github.com/users/mroderick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mroderick/subscriptions","organizations_url":"https://api.github.com/users/mroderick/orgs","repos_url":"https://api.github.com/users/mroderick/repos","events_url":"https://api.github.com/users/mroderick/events{/privacy}","received_events_url":"https://api.github.com/users/mroderick/received_events","type":"User","site_admin":false},"created_at":"2018-10-29T21:04:52Z","updated_at":"2018-10-29T21:04:52Z","author_association":"MEMBER","body":"There are a few properties of having the tests next to the source file, that I enjoy:\r\n\r\n* it is easy to navigate between the source and the test file\r\n    * which makes import/require statements easy\r\n    * it's easy to move files and tests around without breaking things, and you don't have to mirror the folder structure in `test/` as you have in `lib/`\r\n* it is easy to see when the test file is missing\r\n\r\nThere are also some downsides:\r\n\r\n* if you're not careful, you'll put all your tests in the npm packages\r\n* it is NOT following the conventions of mocha\r\n    * this will confuse a few people\r\n    * your test command will have to specify file pattern(s)\r\n\r\nThese days ESLint allows for overrides for glob patterns, which makes having tests with source a whole lot easier. Before, you'd basically have to have two config files and separate lint commands, or always have your tests in a separate folder, where you could place an extrac `.eslintrc` ... or accept that you'd share settings between source and tests.\r\n\r\nI guess it's really just trading one set of conveniences for another set of conveniences. Which one you like more, is probably highly individual.\r\n\r\nOne feature that I really liked when I worked with Rails (a decade or so ago), was that there's an automagic mapping between source and test files, so the test runner would figure things out for itself. This only worked because of the strict adherence to conventions.\r\n\r\nI've been thinking if we could have something similar with mocha, where if a file in `lib/` didn't have a corresponding `.test.js` file either next to it or in `test/`, then the test runner would complain. This is kind of in line with #10, in that exports discovered when the tests are run.\r\n\r\nPerhaps I should take a stab at making such a tool, that could be run before/after your test suite ... or maybe @fearphage wants to make such a tool?"}}
{"actor":{"display_login":"mroderick"}}