From fafb54a6c2366d0c2fc4479e014627e02e1ff591 Mon Sep 17 00:00:00 2001 From: Marek Gilbert Date: Fri, 26 Apr 2019 14:38:28 -0700 Subject: [PATCH] Actually test for the presence of window.fetch. This makes gaxios compatible with tests running with jsdom which defines `window`. --- src/isbrowser.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/isbrowser.ts b/src/isbrowser.ts index 44812f45..1a23259c 100644 --- a/src/isbrowser.ts +++ b/src/isbrowser.ts @@ -15,5 +15,6 @@ */ export function isBrowser(): boolean { - return typeof window !== 'undefined'; + return typeof window !== 'undefined' && + typeof window.fetch !== 'undefined'; }