{"action":"created","issue":{"url":"https://api.github.com/repos/sindresorhus/ava/issues/472","repository_url":"https://api.github.com/repos/sindresorhus/ava","labels_url":"https://api.github.com/repos/sindresorhus/ava/issues/472/labels{/name}","comments_url":"https://api.github.com/repos/sindresorhus/ava/issues/472/comments","events_url":"https://api.github.com/repos/sindresorhus/ava/issues/472/events","html_url":"https://github.com/sindresorhus/ava/issues/472","id":128419196,"number":472,"title":"Recipe for handling concurrency and atomic tests","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sindresorhus/ava/labels/docs","name":"docs","color":"5319e7"},{"url":"https://api.github.com/repos/sindresorhus/ava/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-24T19:31:46Z","updated_at":"2016-04-01T12:45:34Z","closed_at":null,"body":"Concurrency complicates some things like creating fixtures on disk, database, services, etc. Would be nice to document best-practises for handling this.\r\n\r\nFor example, for disk fixtures the [recommended best-practise](https://github.com/sindresorhus/ava#temp-files) is using temp files.\r\n\r\nWhat kind of challenges did you have converting/creating tests to be atomic? Let's discuss.\r\n\r\n-\r\n\r\nFrom the [gitter chat](https://gitter.im/sindresorhus/ava):\r\n\r\n> I have a few questions about Ava.\r\nFirstly good idea, my tests take a while to run, and they could all be\r\nrun concurrently in a fraction of the time.\r\nCurrently I use mocha. The Ava project would run concurrent tests. But a great\r\nnumber of tests that currently exist are set up to populate DBs etc with data then\r\nperhaps an api is hit and the expected data that is received is tested against\r\nthat stuffed into the DB.\r\nSome tests hit remote APIs. Some hit local ones. Although running things concurrently\r\ndoes make things faster it also makes testing trickier. Have thoughts been given\r\nto this?\r\nI am quite happy to start making contributions by explaining the concurrency in the\r\nreadme."},"comment":{"url":"https://api.github.com/repos/sindresorhus/ava/issues/comments/204385518","html_url":"https://github.com/sindresorhus/ava/issues/472#issuecomment-204385518","issue_url":"https://api.github.com/repos/sindresorhus/ava/issues/472","id":204385518,"user":{"login":"novemberborn","id":33538,"avatar_url":"https://avatars.githubusercontent.com/u/33538?v=3","gravatar_id":"","url":"https://api.github.com/users/novemberborn","html_url":"https://github.com/novemberborn","followers_url":"https://api.github.com/users/novemberborn/followers","following_url":"https://api.github.com/users/novemberborn/following{/other_user}","gists_url":"https://api.github.com/users/novemberborn/gists{/gist_id}","starred_url":"https://api.github.com/users/novemberborn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novemberborn/subscriptions","organizations_url":"https://api.github.com/users/novemberborn/orgs","repos_url":"https://api.github.com/users/novemberborn/repos","events_url":"https://api.github.com/users/novemberborn/events{/privacy}","received_events_url":"https://api.github.com/users/novemberborn/received_events","type":"User","site_admin":false},"created_at":"2016-04-01T12:45:34Z","updated_at":"2016-04-01T12:45:34Z","body":"Ideally each test file controls its own fixtures (e.g. different database name from other test files). If that's not possible you'd have to run a setup process before invoking AVA and a teardown process after. I wonder if we could support global `--setup`/`--teardown` options."}}