Skip to content

Colota - Android GPS Location tracker

Fix CI: use globalThis instead of global in tests

Max Dietrichc1dd3c6cf426
diff --git a/apps/mobile/src/components/features/dashboard/__tests__/ServerConnection.test.tsx b/apps/mobile/src/components/features/dashboard/__tests__/ServerConnection.test.tsx
index ffb6a3e2..88943616 100644
--- a/apps/mobile/src/components/features/dashboard/__tests__/ServerConnection.test.tsx
+++ b/apps/mobile/src/components/features/dashboard/__tests__/ServerConnection.test.tsx
@@ -43,7 +43,7 @@ jest.mock("@react-navigation/native", () => ({
}))
const mockFetch = jest.fn()
-global.fetch = mockFetch as any
+;(globalThis as any).fetch = mockFetch
import { ServerConnection } from "../ServerConnection"
diff --git a/apps/mobile/src/utils/__tests__/logger.test.ts b/apps/mobile/src/utils/__tests__/logger.test.ts
index 1de0e3d7..8a3b4055 100644
--- a/apps/mobile/src/utils/__tests__/logger.test.ts
+++ b/apps/mobile/src/utils/__tests__/logger.test.ts
@@ -1,4 +1,4 @@
-const originalDev = (global as any).__DEV__
+const originalDev = (globalThis as any).__DEV__
beforeEach(() => {
jest.spyOn(console, "log").mockImplementation()
@@ -9,7 +9,7 @@ beforeEach(() => {
afterEach(() => {
jest.restoreAllMocks()
jest.resetModules()
- ;(global as any).__DEV__ = originalDev
+ ;(globalThis as any).__DEV__ = originalDev
})
function loadLogger() {
@@ -19,7 +19,7 @@ function loadLogger() {
describe("logger", () => {
describe("in development (__DEV__ = true)", () => {
beforeEach(() => {
- ;(global as any).__DEV__ = true
+ ;(globalThis as any).__DEV__ = true
})
it("debug logs via console.log", () => {
@@ -53,7 +53,7 @@ describe("logger", () => {
describe("in production (__DEV__ = false)", () => {
beforeEach(() => {
- ;(global as any).__DEV__ = false
+ ;(globalThis as any).__DEV__ = false
})
it("debug is suppressed", () => {