From 72019300eccf7f918263af7acf3dd40c16e081d0 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Thu, 30 Jan 2025 10:47:13 -0800 Subject: [PATCH] Avoid calling fail in tests Summary: Looks like we call fail() here which has special meaning in Jest tests but newer versions of Jest don't implement it, and our OSS test run in that newer version. https://github.com/jestjs/jest/issues/11698 Trying to see if it's possible to remove that call to fail() so that OSS and internal tests have consistent behavior. Reviewed By: itamark Differential Revision: D68867479 fbshipit-source-id: 896ffff042849dfff6fe7ff88d61084e20d369dd --- packages/relay-runtime/network/RelayObservable.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/relay-runtime/network/RelayObservable.js b/packages/relay-runtime/network/RelayObservable.js index 6d5a11547a320..e155135e2623a 100644 --- a/packages/relay-runtime/network/RelayObservable.js +++ b/packages/relay-runtime/network/RelayObservable.js @@ -614,11 +614,7 @@ if (__DEV__) { // Default implementation of HostReportErrors() in development builds. // Can be replaced by the host application environment. RelayObservable.onUnhandledError((error, isUncaughtThrownError) => { - declare function fail(string): void; - if (typeof fail === 'function') { - // In test environments (Jest), fail() immediately fails the current test. - fail(String(error)); - } else if (isUncaughtThrownError) { + if (isUncaughtThrownError) { // Rethrow uncaught thrown errors on the next frame to avoid breaking // current logic. setTimeout(() => {