Skip to content
Permalink
Browse files
Fix LogBox.ignoreAllLogs used with no argument (#29310)
Summary:
When you call `LogBox.ignoreAllLogs()` it should ignore logs.

This fixes a bug that made this equivalent to `LogBox.ignoreAllLogs(false)`

## Changelog

[General] [Fixed] - LogBox.ignoreAllLogs() should ignore logs

Pull Request resolved: #29310

Test Plan: Added tests

Reviewed By: TheSavior

Differential Revision: D22448436

Pulled By: rickhanlonii

fbshipit-source-id: 6ba12b9d9c1f29cf3ac503946ac5ca0097425a7a
  • Loading branch information
rickhanlonii authored and facebook-github-bot committed Jul 9, 2020
1 parent ffa3d7f commit f28c7505fa5b4a7ddf1e9311d38dfcd15e8953a2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
@@ -43,7 +43,7 @@ if (__DEV__) {
},

ignoreAllLogs: (value?: ?boolean): void => {
LogBoxData.setDisabled(!!value);
LogBoxData.setDisabled(value == null ? true : value);
},

uninstall: (): void => {
@@ -69,6 +69,30 @@ describe('LogBox', () => {
expect(LogBoxData.isDisabled()).toBe(true);
});

it('will not ignore logs for `ignoreAllLogs(false)`', () => {
expect(LogBoxData.isDisabled()).toBe(false);

LogBox.install();

expect(LogBoxData.isDisabled()).toBe(false);

LogBox.ignoreAllLogs(false);

expect(LogBoxData.isDisabled()).toBe(false);
});

it('will ignore logs for `ignoreAllLogs()`', () => {
expect(LogBoxData.isDisabled()).toBe(false);

LogBox.install();

expect(LogBoxData.isDisabled()).toBe(false);

LogBox.ignoreAllLogs();

expect(LogBoxData.isDisabled()).toBe(true);
});

it('registers warnings', () => {
jest.mock('../Data/LogBoxData');

0 comments on commit f28c750

Please sign in to comment.