{"action":"closed","issue":{"url":"https://api.github.com/repos/wheresrhys/fetch-mock/issues/196","repository_url":"https://api.github.com/repos/wheresrhys/fetch-mock","labels_url":"https://api.github.com/repos/wheresrhys/fetch-mock/issues/196/labels{/name}","comments_url":"https://api.github.com/repos/wheresrhys/fetch-mock/issues/196/comments","events_url":"https://api.github.com/repos/wheresrhys/fetch-mock/issues/196/events","html_url":"https://github.com/wheresrhys/fetch-mock/issues/196","id":236029188,"number":196,"title":"flush does not wait for the requests","user":{"login":"cesaraaron","id":20180899,"avatar_url":"https://avatars0.githubusercontent.com/u/20180899?v=3","gravatar_id":"","url":"https://api.github.com/users/cesaraaron","html_url":"https://github.com/cesaraaron","followers_url":"https://api.github.com/users/cesaraaron/followers","following_url":"https://api.github.com/users/cesaraaron/following{/other_user}","gists_url":"https://api.github.com/users/cesaraaron/gists{/gist_id}","starred_url":"https://api.github.com/users/cesaraaron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cesaraaron/subscriptions","organizations_url":"https://api.github.com/users/cesaraaron/orgs","repos_url":"https://api.github.com/users/cesaraaron/repos","events_url":"https://api.github.com/users/cesaraaron/events{/privacy}","received_events_url":"https://api.github.com/users/cesaraaron/received_events","type":"User","site_admin":false},"labels":[{"id":206254542,"url":"https://api.github.com/repos/wheresrhys/fetch-mock/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-06-14T22:36:20Z","updated_at":"2017-06-24T17:37:55Z","closed_at":"2017-06-24T17:37:55Z","body":"```javascript\r\nconst foo = {\r\n  async get() {\r\n    this.data = await fetch('http://example').then(r => r.text())\r\n  }\r\n}\r\nit('should flush', async () => {\r\n  fetchMock.mock('http://example', 'working!')\r\n  foo.get()\r\n  await fetchMock.flush()\r\n  console.log(foo.data) // undefined\r\n})\r\n```\r\nThis too:\r\n```javascript\r\n...\r\nreturn fetchMock\r\n    .flush()\r\n    .then(() => {\r\n      foo.get()\r\n      return fetchMock.flush()\r\n    })\r\n    .then(() => {\r\n      console.log(foo.data) // undefined\r\n    })\r\n```\r\nHowever this works:\r\n```javascript\r\n  ...\r\n  await new Promise(r => setTimeout(() => r(), 50))\r\n  console.log(foo.data) // working!\r\n```\r\nAm I missing something?\r\n\r\nenv:\r\n\r\n> \"jest\": \"^20.0.3\"\r\n> \"isomorphic-fetch\": \"^2.2.1\"\r\n>  \"fetch-mock\": \"^5.11.0\"\r\n\r\n\r\n"}}
{"actor":{"display_login":"wheresrhys"}}