---
title: "Discussion on \"Mocking console.log with jest\" | Hashnode"
description: "Discussion on \"Mocking console.log with jest\". describe(\"outer\", () => {\n  describe(\"inner\", () => {\n    let spy: jest.SpyInstance;\n\n    beforeAll(() => {\n      spy = jest.spyOn(global.console, \"log\").mockImplementation();\n    });\n\n    afterAll(() => {\n      spy.mockRestore();\n    });\n\n    it(\"do..."
url: "https://hashnode.com/posts/mocking-consolelog-with-jest/60bd5190e36d51141c95d199"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Mocking console.log with jest](https://thmsobrmlr.hashnode.dev/mocking-consolelog-with-jest?utm_source=hashnode&utm_medium=feed)

describe("outer", () => { describe("inner", () => { let spy: jest.SpyInstance; beforeAll(() => { spy = jest.spyOn(global.console, "log").mockImplementation(); }); afterAll(() => { spy.mockRestore(); }); it("do...

Jun 6, 2021 · 1 min read · thmsobrmlr.hashnode.dev  
Read the article

-   [#jest](https://hashnode.com/tag/jest)
-   [#typescript](https://hashnode.com/tag/typescript)
-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Thomas Obermüller](https://hashnode.com/@thmsobrmlr)

@thmsobrmlr

  
[View profile](https://hashnode.com/@thmsobrmlr)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
