{"action":"opened","issue":{"url":"https://api.github.com/repos/avajs/ava/issues/1147","repository_url":"https://api.github.com/repos/avajs/ava","labels_url":"https://api.github.com/repos/avajs/ava/issues/1147/labels{/name}","comments_url":"https://api.github.com/repos/avajs/ava/issues/1147/comments","events_url":"https://api.github.com/repos/avajs/ava/issues/1147/events","html_url":"https://github.com/avajs/ava/issues/1147","id":194251167,"number":1147,"title":"Controlling Parallelism","user":{"login":"ccorcos","id":1794527,"avatar_url":"https://avatars.githubusercontent.com/u/1794527?v=3","gravatar_id":"","url":"https://api.github.com/users/ccorcos","html_url":"https://github.com/ccorcos","followers_url":"https://api.github.com/users/ccorcos/followers","following_url":"https://api.github.com/users/ccorcos/following{/other_user}","gists_url":"https://api.github.com/users/ccorcos/gists{/gist_id}","starred_url":"https://api.github.com/users/ccorcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccorcos/subscriptions","organizations_url":"https://api.github.com/users/ccorcos/orgs","repos_url":"https://api.github.com/users/ccorcos/repos","events_url":"https://api.github.com/users/ccorcos/events{/privacy}","received_events_url":"https://api.github.com/users/ccorcos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-08T05:34:53Z","updated_at":"2016-12-08T05:34:53Z","closed_at":null,"body":"I looked up \"nested tests\" and found [this issue](https://github.com/avajs/ava/issues/62) but that discussion was going a different direction from what I was thinking.\r\n\r\nI'm working on a [CLI tool project](https://github.com/ccorcos/doug/blob/956630e3416721150abd29cfaf9db7b59056ae1e/test/doug-app.sh) and I want to convert my test from that shells script to Node.js, preferably with Ava. However, some things need to happen in a certain order. \r\n\r\nHere's how far I've gotten:\r\n\r\n```js\r\nimport test from 'ava'\r\nimport shell from 'shelljs'\r\nimport exists from 'doug/utils/exists'\r\n\r\nshell.config.fatal = true\r\n\r\ntest.before('doug-app init', (t) => {\r\n  // initialize doug-app\r\n  shell.cd('~')\r\n  shell.exec('doug-app init doug-app-test')\r\n  t.truthy(exists('doug-app-test'))\r\n\r\n  // link doug-app\r\n  shell.cd('cd ~/doug-app-test')\r\n  shell.exec('npm link doug-app')\r\n\r\n  // setup local git origin\r\n  shell.mkdir('doug-app-origin')\r\n  shell.cd('doug-app-origin')\r\n  shell.exec('git init --bare')\r\n\r\n  // push initial commit\r\n  shell.cd('~/doug-app-test')\r\n  shell.exec([\r\n    'git init',\r\n    'git add .',\r\n    'git config --global user.email \"test@test.com\"',\r\n    'git config --global user.name \"Doug Test\"',\r\n    'git commit -m \"doug-app-test\"',\r\n    'git remote add origin ~/doug-app-origin',\r\n    'git push origin master',\r\n  ].join('; '))\r\n})\r\n\r\ntest.test('doug-app test', (t) => {\r\n  shell.cd('cd ~/doug-app-test')\r\n  shell.exec('doug-app test')\r\n})\r\n\r\ntest.test('doug-app build', (t) => {\r\n  shell.cd('cd ~/doug-app-test')\r\n  shell.exec('doug-app build')\r\n  t.truthy(exists('dist'))\r\n})\r\n\r\ntest.test('doug-app deploy', (t) => {\r\n  shell.cd('cd ~/doug-app-test')\r\n  shell.exec('doug-app deploy')\r\n  shell.cd('~/doug-app-origin')\r\n  t.truthy(shell.exec('git branch | grep gh_pages').stdout.trim())\r\n})\r\n```\r\n\r\nThe thing is, `deploy` need to happen after `build`. But it is a different test, and can in parallel with other commands such as `test`..."}}
{"actor":{"display_login":"ccorcos"}}