{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/5518","repository_url":"https://api.github.com/repos/facebook/jest","labels_url":"https://api.github.com/repos/facebook/jest/issues/5518/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/5518/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/5518/events","html_url":"https://github.com/facebook/jest/issues/5518","id":296159837,"number":5518,"title":"Feature Request: block console messages.","user":{"login":"xianxingg","id":11285464,"avatar_url":"https://avatars0.githubusercontent.com/u/11285464?v=4","gravatar_id":"","url":"https://api.github.com/users/xianxingg","html_url":"https://github.com/xianxingg","followers_url":"https://api.github.com/users/xianxingg/followers","following_url":"https://api.github.com/users/xianxingg/following{/other_user}","gists_url":"https://api.github.com/users/xianxingg/gists{/gist_id}","starred_url":"https://api.github.com/users/xianxingg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xianxingg/subscriptions","organizations_url":"https://api.github.com/users/xianxingg/orgs","repos_url":"https://api.github.com/users/xianxingg/repos","events_url":"https://api.github.com/users/xianxingg/events{/privacy}","received_events_url":"https://api.github.com/users/xianxingg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-11T04:35:27Z","updated_at":"2018-02-11T09:08:22Z","closed_at":"2018-02-11T09:08:22Z","author_association":"NONE","body":"eg i want to test a function `foo` in `a.js`, and `foo` will log many info into console.\r\nso is it possible to write the `a.test.js` in some way that is able to block the console.log messages?\r\n\r\na.test.js\r\n```\r\nconst foo = require('./a.js')\r\nit('should work', () => {\r\n  blockConsole('log', 'warn'); // can we do this?\r\n  const result = foo();\r\n  expect(result).toBe(1);\r\n});"},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/364735750","html_url":"https://github.com/facebook/jest/issues/5518#issuecomment-364735750","issue_url":"https://api.github.com/repos/facebook/jest/issues/5518","id":364735750,"user":{"login":"cpojer","id":13352,"avatar_url":"https://avatars0.githubusercontent.com/u/13352?v=4","gravatar_id":"","url":"https://api.github.com/users/cpojer","html_url":"https://github.com/cpojer","followers_url":"https://api.github.com/users/cpojer/followers","following_url":"https://api.github.com/users/cpojer/following{/other_user}","gists_url":"https://api.github.com/users/cpojer/gists{/gist_id}","starred_url":"https://api.github.com/users/cpojer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpojer/subscriptions","organizations_url":"https://api.github.com/users/cpojer/orgs","repos_url":"https://api.github.com/users/cpojer/repos","events_url":"https://api.github.com/users/cpojer/events{/privacy}","received_events_url":"https://api.github.com/users/cpojer/received_events","type":"User","site_admin":false},"created_at":"2018-02-11T09:08:22Z","updated_at":"2018-02-11T09:08:22Z","author_association":"CONTRIBUTOR","body":"Unfortunately, that is not possible. However, you can do `console.log = jest.fn()` and then later check the values of the mock function."}}
{"actor":{"display_login":"cpojer"}}