{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/14569","repository_url":"https://api.github.com/repos/emberjs/ember.js","labels_url":"https://api.github.com/repos/emberjs/ember.js/issues/14569/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/ember.js/issues/14569/comments","events_url":"https://api.github.com/repos/emberjs/ember.js/issues/14569/events","html_url":"https://github.com/emberjs/ember.js/issues/14569","id":186516219,"number":14569,"title":"Better compatibility with async/await function in test","user":{"login":"GCorbel","id":1296201,"avatar_url":"https://avatars.githubusercontent.com/u/1296201?v=3","gravatar_id":"","url":"https://api.github.com/users/GCorbel","html_url":"https://github.com/GCorbel","followers_url":"https://api.github.com/users/GCorbel/followers","following_url":"https://api.github.com/users/GCorbel/following{/other_user}","gists_url":"https://api.github.com/users/GCorbel/gists{/gist_id}","starred_url":"https://api.github.com/users/GCorbel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GCorbel/subscriptions","organizations_url":"https://api.github.com/users/GCorbel/orgs","repos_url":"https://api.github.com/users/GCorbel/repos","events_url":"https://api.github.com/users/GCorbel/events{/privacy}","received_events_url":"https://api.github.com/users/GCorbel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-01T11:51:36Z","updated_at":"2016-11-01T11:58:46Z","closed_at":null,"body":"Hi,\r\n\r\nI like the next 'async/await' feature proposed in es7. My main goal is to have a cleaner syntax. I tried to do an action like this : \r\n\r\n```\r\n  actions: {\r\n    async clone(model) {\r\n      const clone = await model.clone();\r\n\r\n      clone.set('name', clone.get('name') + ' - copie');\r\n      clone.set('activity', model.get('activity'));\r\n      this._nestedSave(clone, 'groups');\r\n    }\r\n  }\r\n\r\n```\r\n\r\nIt works but I cannot test it because I have the message \"You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in a run\". I described the error in [this SO question](http://stackoverflow.com/questions/40338020/using-async-await-in-test-mode-without-ember-run). I know I can use `Ember.run` but async/await become useless.\r\n\r\nI saw I can set `Ember.testing` to false but there will be problems later.\r\n\r\nIs there a solution or plan to do that ?\r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/comments/257549350","html_url":"https://github.com/emberjs/ember.js/issues/14569#issuecomment-257549350","issue_url":"https://api.github.com/repos/emberjs/ember.js/issues/14569","id":257549350,"user":{"login":"GCorbel","id":1296201,"avatar_url":"https://avatars.githubusercontent.com/u/1296201?v=3","gravatar_id":"","url":"https://api.github.com/users/GCorbel","html_url":"https://github.com/GCorbel","followers_url":"https://api.github.com/users/GCorbel/followers","following_url":"https://api.github.com/users/GCorbel/following{/other_user}","gists_url":"https://api.github.com/users/GCorbel/gists{/gist_id}","starred_url":"https://api.github.com/users/GCorbel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GCorbel/subscriptions","organizations_url":"https://api.github.com/users/GCorbel/orgs","repos_url":"https://api.github.com/users/GCorbel/repos","events_url":"https://api.github.com/users/GCorbel/events{/privacy}","received_events_url":"https://api.github.com/users/GCorbel/received_events","type":"User","site_admin":false},"created_at":"2016-11-01T11:58:46Z","updated_at":"2016-11-01T11:58:46Z","body":"I just saw [this article](https://karolgalanciak.com/blog/2015/12/18/ember-and-es7-async-slash-await/) and it seems to work with test in his code.\r\n\r\nHere is my test : \r\n\r\n```\r\nimport destroyApp from '../helpers/destroy-app';\r\nimport {describe, it, beforeEach, afterEach} from 'mocha';\r\nimport {expect} from 'chai';\r\nimport startApp from '../helpers/start-app';\r\nimport {authenticateSession} from '../helpers/ember-simple-auth';\r\nimport page from 'tiny/tests/pages/courses';\r\n\r\ndescribe('Acceptance: Courses', ()=> {\r\n  let application;\r\n\r\n  beforeEach(function () {\r\n    $.Velocity.mock = true;\r\n    application = startApp();\r\n    authenticateSession(application, {data: {attributes: {fullaccess: true, 'access-token': 123}}});\r\n  });\r\n\r\n  afterEach(function () {\r\n    destroyApp(application);\r\n  });\r\n\r\n  it('can clone a course', async function () {\r\n    const activity = server.create('activity');\r\n\r\n    server.create('course', {name: 'Course', activity});\r\n\r\n    await page.visitIndex();\r\n\r\n    await page.clone();\r\n\r\n    expect(page.courseName).to.eq('Course');\r\n  });\r\n});\r\n```"}}
{"actor":{"display_login":"GCorbel"}}