{"action":"created","issue":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/1350","repository_url":"https://api.github.com/repos/jasmine/jasmine","labels_url":"https://api.github.com/repos/jasmine/jasmine/issues/1350/labels{/name}","comments_url":"https://api.github.com/repos/jasmine/jasmine/issues/1350/comments","events_url":"https://api.github.com/repos/jasmine/jasmine/issues/1350/events","html_url":"https://github.com/jasmine/jasmine/issues/1350","id":227206241,"number":1350,"title":"Does jasmine 2.6.0 not support ES7 async await functions?","user":{"login":"thepiyush13","id":2778463,"avatar_url":"https://avatars2.githubusercontent.com/u/2778463?v=3","gravatar_id":"","url":"https://api.github.com/users/thepiyush13","html_url":"https://github.com/thepiyush13","followers_url":"https://api.github.com/users/thepiyush13/followers","following_url":"https://api.github.com/users/thepiyush13/following{/other_user}","gists_url":"https://api.github.com/users/thepiyush13/gists{/gist_id}","starred_url":"https://api.github.com/users/thepiyush13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thepiyush13/subscriptions","organizations_url":"https://api.github.com/users/thepiyush13/orgs","repos_url":"https://api.github.com/users/thepiyush13/repos","events_url":"https://api.github.com/users/thepiyush13/events{/privacy}","received_events_url":"https://api.github.com/users/thepiyush13/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-08T23:41:11Z","updated_at":"2017-05-10T21:08:44Z","closed_at":null,"body":"I am trying to use Jasmine to test functions that use ES7 async await features. Jasmine although works for promises and async functions, it fails for ES7 async function. For example: \r\n\r\n```\r\ndescribe(\"async-test\", () => {\r\n  it('should run test', (async function(done) {\r\n     var x = await fakeRequest();\r\n     expect(x).toBeDefined();\r\n     done();\r\n  }));\r\n \r\n});\r\n\r\nasync function fakeRequest() {\r\n     let result = await another_request();\r\n     return result;\r\n}\r\n\r\nasync function another_request(){\r\n    // returns promise resolution or some async function call return\r\n}\r\n```\r\n\r\nit always gives this error:\r\n\r\n```\r\nasync-test\r\n    ✖ should run test\r\n      PhantomJS 2.1.1 (Mac OS X 0.0.0)\r\n    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. in config/karma-shim.js (line 98794)\r\n    ZoneAwareError@webpack:///~/zone.js/dist/zone.js:999:0 <- config/karma-shim.js:98794:28\r\n```\r\n\r\nHow can I make it work. Jasmine works when I am only dealing with promises but as soon as ES7 come in, it stops working. How can I make it work with functions that use ES7 features?\r\n\r\nI am running \r\n`\"jasmine-core\": \"^2.6.0\",\"karma\": \"^1.6.0\", \"typescript\": \"~2.2.2\" and Node 7.10.0`"},"comment":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/comments/300613176","html_url":"https://github.com/jasmine/jasmine/issues/1350#issuecomment-300613176","issue_url":"https://api.github.com/repos/jasmine/jasmine/issues/1350","id":300613176,"user":{"login":"slackersoft","id":512724,"avatar_url":"https://avatars3.githubusercontent.com/u/512724?v=3","gravatar_id":"","url":"https://api.github.com/users/slackersoft","html_url":"https://github.com/slackersoft","followers_url":"https://api.github.com/users/slackersoft/followers","following_url":"https://api.github.com/users/slackersoft/following{/other_user}","gists_url":"https://api.github.com/users/slackersoft/gists{/gist_id}","starred_url":"https://api.github.com/users/slackersoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slackersoft/subscriptions","organizations_url":"https://api.github.com/users/slackersoft/orgs","repos_url":"https://api.github.com/users/slackersoft/repos","events_url":"https://api.github.com/users/slackersoft/events{/privacy}","received_events_url":"https://api.github.com/users/slackersoft/received_events","type":"User","site_admin":false},"created_at":"2017-05-10T21:08:44Z","updated_at":"2017-05-10T21:08:44Z","body":"Jasmine never truly supported `async` functions, since it would never actually `await` them. In 2.6, Jasmine will now throw an `Error` if something that is not a `function` is passed into it because users would accidentally pass in an `async function()` without a `done` parameter and Jasmine would just execute it as if it was synchronous, moving on to the next spec at the first `await`.\r\n\r\nWe're looking into fully supporting promises (via #1270 or something like it), which would then also hopefully allow `async`/`await` to work as expected. "}}
{"actor":{"display_login":"slackersoft"}}