Skip to content

Commit

Permalink
do not mock console functions globaly but noopify them
Browse files Browse the repository at this point in the history
  • Loading branch information
HuiSF committed Mar 19, 2024
1 parent 7902e53 commit 913b11e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Suppress console messages printing during unit tests.
// Comment out log level as necessary (e.g. while debugging tests)
const noop = () => undefined;

global.console = {
...console,
log: jest.fn(),
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
log: noop,
debug: noop,
info: noop,
warn: noop,
error: noop,
};

// React Native global
Expand Down

0 comments on commit 913b11e

Please sign in to comment.