Remove some unhandled rejections in tests

Summary: Fixed several tests that caused uncaught promise rejects to fire after the tests finished. This caused jest to fail if there are too many of them.

Reviewed By: aigoncharov

Differential Revision: D32118124

fbshipit-source-id: 50734dab6dee2efec7f056940af72858b27b1707
This commit is contained in:
Michel Weststrate
2021-11-03 03:12:39 -07:00
committed by Facebook GitHub Bot
parent 8f3e729b7b
commit 72ce759e61
7 changed files with 55 additions and 30 deletions

View File

@@ -333,7 +333,11 @@ export abstract class BasePluginInstance {
if (!this.activated) {
this.flipperLib.enableMenuEntries(this.menuEntries);
this.activated = true;
this.events.emit('activate');
try {
this.events.emit('activate');
} catch (e) {
console.error(`Failed to activate plugin: ${this.definition.id}`, e);
}
this.flipperLib.logger.trackTimeSince(
`activePlugin-${this.definition.id}`,
);
@@ -347,7 +351,11 @@ export abstract class BasePluginInstance {
if (this.activated) {
this.activated = false;
this.lastDeeplink = undefined;
this.events.emit('deactivate');
try {
this.events.emit('deactivate');
} catch (e) {
console.error(`Failed to deactivate plugin: ${this.definition.id}`, e);
}
}
}