Convert UI to Sandy
Summary: With proper notification, components and code clean up in place, time for the reward and giving the plugin a fresh look. Changelog: CrashReporter plugin got a fresh look and several navigation issues were addressed. Reviewed By: passy Differential Revision: D28102398 fbshipit-source-id: 5721634e45c5b1fc5fba3fb0c0b8970635b80b46
This commit is contained in:
committed by
Facebook GitHub Bot
parent
01ea822341
commit
e707fcc9f9
@@ -12,8 +12,12 @@ import {Crash} from '../index';
|
||||
import {TestUtils} from 'flipper-plugin';
|
||||
import {getPluginKey} from 'flipper';
|
||||
import * as CrashReporterPlugin from '../index';
|
||||
import {parseCrashLog} from '../crash-utils';
|
||||
import {parsePath, shouldShowiOSCrashNotification} from '../ios-crash-utils';
|
||||
import {
|
||||
parseIosCrash,
|
||||
parsePath,
|
||||
shouldShowiOSCrashNotification,
|
||||
} from '../ios-crash-utils';
|
||||
import {parseAndroidCrash} from '../android-crash-utils';
|
||||
|
||||
function getCrash(
|
||||
id: number,
|
||||
@@ -42,7 +46,7 @@ function assertCrash(crash: Crash, expectedCrash: Crash) {
|
||||
test('test the parsing of the date and crash info for the log which matches the predefined regex', () => {
|
||||
const log =
|
||||
'Blaa Blaaa \n Blaa Blaaa \n Exception Type: SIGSEGV \n Blaa Blaa \n Blaa Blaa Date/Time: 2019-03-21 12:07:00.861 +0000 \n Blaa balaaa';
|
||||
const crash = parseCrashLog(log, 'iOS', undefined);
|
||||
const crash = parseIosCrash(log);
|
||||
expect(crash.callstack).toEqual(log);
|
||||
expect(crash.reason).toEqual('SIGSEGV');
|
||||
expect(crash.name).toEqual('SIGSEGV');
|
||||
@@ -52,16 +56,15 @@ test('test the parsing of the date and crash info for the log which matches the
|
||||
test('test the parsing of the reason for crash when log matches the crash regex, but there is no mention of date', () => {
|
||||
const log =
|
||||
'Blaa Blaaa \n Blaa Blaaa \n Exception Type: SIGSEGV \n Blaa Blaa \n Blaa Blaa';
|
||||
const crash = parseCrashLog(log, 'iOS', undefined);
|
||||
const crash = parseIosCrash(log);
|
||||
expect(crash.callstack).toEqual(log);
|
||||
expect(crash.reason).toEqual('SIGSEGV');
|
||||
expect(crash.name).toEqual('SIGSEGV');
|
||||
expect(crash.date).toBeUndefined();
|
||||
});
|
||||
|
||||
test('test the parsing of the crash log when log does not match the predefined regex but is alphanumeric', () => {
|
||||
const log = 'Blaa Blaaa \n Blaa Blaaa \n Blaa Blaaa';
|
||||
const crash = parseCrashLog(log, 'iOS', undefined);
|
||||
const crash = parseIosCrash(log);
|
||||
expect(crash.callstack).toEqual(log);
|
||||
expect(crash.reason).toEqual('Cannot figure out the cause');
|
||||
expect(crash.name).toEqual('Cannot figure out the cause');
|
||||
@@ -70,25 +73,23 @@ test('test the parsing of the crash log when log does not match the predefined r
|
||||
test('test the parsing of the reason for crash when log does not match the predefined regex contains unicode character', () => {
|
||||
const log =
|
||||
'Blaa Blaaa \n Blaa Blaaa \n Exception Type: 🍕🐬 \n Blaa Blaa \n Blaa Blaa';
|
||||
const crash = parseCrashLog(log, 'iOS', undefined);
|
||||
const crash = parseIosCrash(log);
|
||||
expect(crash.callstack).toEqual(log);
|
||||
expect(crash.reason).toEqual('Cannot figure out the cause');
|
||||
expect(crash.name).toEqual('Cannot figure out the cause');
|
||||
expect(crash.date).toBeUndefined();
|
||||
});
|
||||
test('test the parsing of the reason for crash when log is empty', () => {
|
||||
const log = '';
|
||||
const crash = parseCrashLog(log, 'iOS', undefined);
|
||||
const crash = parseIosCrash(log);
|
||||
expect(crash.callstack).toEqual(log);
|
||||
expect(crash.reason).toEqual('Cannot figure out the cause');
|
||||
expect(crash.name).toEqual('Cannot figure out the cause');
|
||||
expect(crash.date).toBeUndefined();
|
||||
});
|
||||
test('test the parsing of the Android crash log for the proper android crash format', () => {
|
||||
const log =
|
||||
'FATAL EXCEPTION: main\nProcess: com.facebook.flipper.sample, PID: 27026\njava.lang.IndexOutOfBoundsException: Index: 190, Size: 0\n\tat java.util.ArrayList.get(ArrayList.java:437)\n\tat com.facebook.flipper.sample.RootComponentSpec.hitGetRequest(RootComponentSpec.java:72)\n\tat com.facebook.flipper.sample.RootComponent.hitGetRequest(RootComponent.java:46)\n';
|
||||
const date = new Date();
|
||||
const crash = parseCrashLog(log, 'Android', date);
|
||||
const crash = parseAndroidCrash(log, date);
|
||||
expect(crash.callstack).toEqual(log);
|
||||
expect(crash.reason).toEqual(
|
||||
'java.lang.IndexOutOfBoundsException: Index: 190, Size: 0',
|
||||
@@ -98,7 +99,7 @@ test('test the parsing of the Android crash log for the proper android crash for
|
||||
});
|
||||
test('test the parsing of the Android crash log for the unknown crash format and no date', () => {
|
||||
const log = 'Blaa Blaa Blaa';
|
||||
const crash = parseCrashLog(log, 'Android', undefined);
|
||||
const crash = parseAndroidCrash(log, undefined);
|
||||
expect(crash.callstack).toEqual(log);
|
||||
expect(crash.reason).toEqual('Cannot figure out the cause');
|
||||
expect(crash.name).toEqual('Cannot figure out the cause');
|
||||
@@ -106,7 +107,7 @@ test('test the parsing of the Android crash log for the unknown crash format and
|
||||
});
|
||||
test('test the parsing of the Android crash log for the partial format matching the crash format', () => {
|
||||
const log = 'First Line Break \n Blaa Blaa \n Blaa Blaa ';
|
||||
const crash = parseCrashLog(log, 'Android', undefined);
|
||||
const crash = parseAndroidCrash(log, undefined);
|
||||
expect(crash.callstack).toEqual(log);
|
||||
expect(crash.reason).toEqual('Cannot figure out the cause');
|
||||
expect(crash.name).toEqual('First Line Break ');
|
||||
@@ -114,7 +115,7 @@ test('test the parsing of the Android crash log for the partial format matching
|
||||
test('test the parsing of the Android crash log with os being iOS', () => {
|
||||
const log =
|
||||
'FATAL EXCEPTION: main\nProcess: com.facebook.flipper.sample, PID: 27026\njava.lang.IndexOutOfBoundsException: Index: 190, Size: 0\n\tat java.util.ArrayList.get(ArrayList.java:437)\n\tat com.facebook.flipper.sample.RootComponentSpec.hitGetRequest(RootComponentSpec.java:72)\n\tat com.facebook.flipper.sample.RootComponent.hitGetRequest(RootComponent.java:46)\n';
|
||||
const crash = parseCrashLog(log, 'iOS', undefined);
|
||||
const crash = parseIosCrash(log);
|
||||
expect(crash.callstack).toEqual(log);
|
||||
expect(crash.reason).toEqual('Cannot figure out the cause');
|
||||
expect(crash.name).toEqual('Cannot figure out the cause');
|
||||
@@ -165,7 +166,7 @@ test('test getNewPersistedStateFromCrashLog for non-empty defaultPersistedState
|
||||
const pluginStateCrash = getCrash(0, 'callstack', 'crash1', 'crash1');
|
||||
plugin.instance.reportCrash(pluginStateCrash);
|
||||
const content = 'Blaa Blaaa \n Blaa Blaaa';
|
||||
plugin.instance.reportCrash(parseCrashLog(content, 'iOS', undefined));
|
||||
plugin.instance.reportCrash(parseIosCrash(content));
|
||||
const crashes = plugin.instance.crashes.get();
|
||||
expect(crashes.length).toEqual(2);
|
||||
assertCrash(crashes[0], pluginStateCrash);
|
||||
@@ -180,18 +181,6 @@ test('test getNewPersistedStateFromCrashLog for non-empty defaultPersistedState
|
||||
);
|
||||
});
|
||||
|
||||
test('test getNewPersistedStateFromCrashLog when os is undefined', () => {
|
||||
const plugin = TestUtils.startDevicePlugin(CrashReporterPlugin);
|
||||
const content = 'Blaa Blaaa \n Blaa Blaaa';
|
||||
expect(() => {
|
||||
plugin.instance.reportCrash(
|
||||
parseCrashLog(content, undefined as any, undefined),
|
||||
);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`"Unsupported OS"`);
|
||||
const crashes = plugin.instance.crashes.get();
|
||||
expect(crashes.length).toEqual(0);
|
||||
});
|
||||
|
||||
test('test parsing of path when inputs are correct', () => {
|
||||
const content =
|
||||
'Blaa Blaaa \n Blaa Blaaa \n Path: path/to/simulator/TH1S-15DEV1CE-1D/AppName.app/AppName \n Blaa Blaa \n Blaa Blaa';
|
||||
|
||||
Reference in New Issue
Block a user