Skip to content

Commit

Permalink
Mocks to fix: handleException is not a function (#29849)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewlms committed Sep 24, 2020
1 parent 9f00752 commit 3ea724d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Libraries/LogBox/Data/LogBoxData.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import type {
import parseErrorStack from '../../Core/Devtools/parseErrorStack';
import type {ExtendedError} from '../../Core/Devtools/parseErrorStack';
import NativeLogBox from '../../NativeModules/specs/NativeLogBox';

const ExceptionsManager = require('../../Core/ExceptionsManager');

export type LogBoxLogs = Set<LogBoxLog>;
export type LogData = $ReadOnly<{|
level: LogLevel,
Expand Down Expand Up @@ -98,8 +101,6 @@ export function reportLogBoxError(
error: ExtendedError,
componentStack?: string,
): void {
const ExceptionsManager = require('../../Core/ExceptionsManager');

error.forceRedbox = true;
error.message = `${LOGBOX_ERROR_MESSAGE}\n\n${error.message}`;
if (componentStack != null) {
Expand Down
7 changes: 7 additions & 0 deletions jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ jest
reportException: jest.fn(),
},
}))
.mock('../Libraries/Core/ExceptionsManager', () => {
return {
handleException: (...args) => {
return;
},
};
})
.mock('../Libraries/ReactNative/UIManager', () => ({
AndroidViewPager: {
Commands: {
Expand Down

0 comments on commit 3ea724d

Please sign in to comment.