payload: {"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/4521","repository_url":"https://api.github.com/repos/ReactiveX/rxjs","labels_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/4521/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/4521/comments","events_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/4521/events","html_url":"https://github.com/ReactiveX/rxjs/issues/4521","id":405353093,"node_id":"MDU6SXNzdWU0MDUzNTMwOTM=","number":4521,"title":"expectObservable runs asynchronously","user":{"login":"whiteinge","id":91293,"node_id":"MDQ6VXNlcjkxMjkz","avatar_url":"https://avatars2.githubusercontent.com/u/91293?v=4","gravatar_id":"","url":"https://api.github.com/users/whiteinge","html_url":"https://github.com/whiteinge","followers_url":"https://api.github.com/users/whiteinge/followers","following_url":"https://api.github.com/users/whiteinge/following{/other_user}","gists_url":"https://api.github.com/users/whiteinge/gists{/gist_id}","starred_url":"https://api.github.com/users/whiteinge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whiteinge/subscriptions","organizations_url":"https://api.github.com/users/whiteinge/orgs","repos_url":"https://api.github.com/users/whiteinge/repos","events_url":"https://api.github.com/users/whiteinge/events{/privacy}","received_events_url":"https://api.github.com/users/whiteinge/received_events","type":"User","site_admin":false},"labels":[{"id":550831467,"node_id":"MDU6TGFiZWw1NTA4MzE0Njc=","url":"https://api.github.com/repos/ReactiveX/rxjs/labels/type:%20docs","name":"type: docs","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2019-01-31T17:19:57Z","updated_at":"2019-02-05T05:33:23Z","closed_at":null,"author_association":"NONE","body":"## Bug Report\r\n\r\n**Current Behavior**\r\n\r\n`expectObservable` runs asynchronously.\r\n\r\n**Reproduction**\r\n\r\n```js\r\nconst scheduler = new TestScheduler((actual, expected) => {\r\n    console.log('TestScheduler', {actual, expected});\r\n})\r\n\r\nscheduler.run(({hot, expectObservable}) => {\r\n    expectObservable(hot('a')).toBe('a');\r\n    console.log('This is run before expectObservable.');\r\n\r\n    setTimeout(() => console.log('This is run after expectObservable.'), 0);\r\n});\r\n```\r\n\r\n**Expected behavior**\r\n\r\nThat the whole test suite will run synchronously.\r\n\r\n**Environment**\r\n\r\n- RxJS 6.4.0\r\n\r\n**Additional context/Screenshots**\r\n\r\nThis caused a confusing problem with a mocked function in Jest that boiled down to the following:\r\n\r\n```js\r\nexpectObservable(aStreamThatFlatMapsMyMockedFunction$).toBe(result);\r\nexpect(myMockedFunction).toHaveBeenCalled();\r\n```\r\n\r\nThe second assertion runs first and since Jest short-circuits on failures the stream is never subscribed, which leads to very confusing error messages.\r\n\r\nWorkarounds:\r\n\r\n- Call `flush()` after `expectObservable()`.\r\n- Wrap subsequent assertions in a `setTimeout(() => {...assertions...}, 0)` to cause the event loop to turn once first."},"comment":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/comments/460518671","html_url":"https://github.com/ReactiveX/rxjs/issues/4521#issuecomment-460518671","issue_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/4521","id":460518671,"node_id":"MDEyOklzc3VlQ29tbWVudDQ2MDUxODY3MQ==","user":{"login":"benlesh","id":1540597,"node_id":"MDQ6VXNlcjE1NDA1OTc=","avatar_url":"https://avatars0.githubusercontent.com/u/1540597?v=4","gravatar_id":"","url":"https://api.github.com/users/benlesh","html_url":"https://github.com/benlesh","followers_url":"https://api.github.com/users/benlesh/followers","following_url":"https://api.github.com/users/benlesh/following{/other_user}","gists_url":"https://api.github.com/users/benlesh/gists{/gist_id}","starred_url":"https://api.github.com/users/benlesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benlesh/subscriptions","organizations_url":"https://api.github.com/users/benlesh/orgs","repos_url":"https://api.github.com/users/benlesh/repos","events_url":"https://api.github.com/users/benlesh/events{/privacy}","received_events_url":"https://api.github.com/users/benlesh/received_events","type":"User","site_admin":false},"created_at":"2019-02-05T05:33:23Z","updated_at":"2019-02-05T05:33:23Z","author_association":"MEMBER","body":":) You're BOTH RIGHT!!!\r\n\r\nWhat's \"asynchronous\" or \"synchronous\" is relative to any given execution context.\r\n"}}
other: {"actor":{"display_login":"benlesh"}}