Skip to content

fix: prevent redirect loop when already on login page #292

fix: prevent redirect loop when already on login page

fix: prevent redirect loop when already on login page #292

Triggered via pull request January 12, 2026 18:56
@eliorheliorh
synchronize #77
fix-login-loop
Status Failure
Total duration 21s
Artifacts

unit-tests.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

10 errors
tests/unit/auth.test.js > Auth Module > setToken() > should set token in axios headers: src/modules/analytics.ts#L189
TypeError: window.addEventListener is not a function ❯ Module.createAnalyticsModule src/modules/analytics.ts:189:12 ❯ Module.createClient src/client.ts:159:16 ❯ tests/unit/auth.test.js:13:14
tests/unit/auth.test.js > Auth Module > logout() > should reload page when no redirect URL is provided: src/modules/analytics.ts#L189
TypeError: window.addEventListener is not a function ❯ Module.createAnalyticsModule src/modules/analytics.ts:189:12 ❯ Module.createClient src/client.ts:159:16 ❯ tests/unit/auth.test.js:13:14
tests/unit/auth.test.js > Auth Module > logout() > should redirect to specified URL after logout: src/modules/analytics.ts#L189
TypeError: window.addEventListener is not a function ❯ Module.createAnalyticsModule src/modules/analytics.ts:189:12 ❯ Module.createClient src/client.ts:159:16 ❯ tests/unit/auth.test.js:13:14
tests/unit/auth.test.js > Auth Module > logout() > should handle localStorage errors gracefully: src/modules/analytics.ts#L189
TypeError: window.addEventListener is not a function ❯ Module.createAnalyticsModule src/modules/analytics.ts:189:12 ❯ Module.createClient src/client.ts:159:16 ❯ tests/unit/auth.test.js:13:14
tests/unit/auth.test.js > Auth Module > logout() > should remove token from localStorage in browser environment: src/modules/analytics.ts#L189
TypeError: window.addEventListener is not a function ❯ Module.createAnalyticsModule src/modules/analytics.ts:189:12 ❯ Module.createClient src/client.ts:159:16 ❯ tests/unit/auth.test.js:13:14
tests/unit/auth.test.js > Auth Module > logout() > should remove token from axios headers: src/modules/analytics.ts#L189
TypeError: window.addEventListener is not a function ❯ Module.createAnalyticsModule src/modules/analytics.ts:189:12 ❯ Module.createClient src/client.ts:159:16 ❯ tests/unit/auth.test.js:13:14
tests/unit/auth.test.js > Auth Module > login() > should use relative URL for login redirect when appBaseUrl is not provided: src/modules/analytics.ts#L189
TypeError: window.addEventListener is not a function ❯ Module.createAnalyticsModule src/modules/analytics.ts:189:12 ❯ Module.createClient src/client.ts:159:16 ❯ tests/unit/auth.test.js:13:14
tests/unit/auth.test.js > Auth Module > login() > should use appBaseUrl for login redirect when provided: src/modules/analytics.ts#L189
TypeError: window.addEventListener is not a function ❯ Module.createAnalyticsModule src/modules/analytics.ts:189:12 ❯ Module.createClient src/client.ts:159:16 ❯ tests/unit/auth.test.js:13:14
tests/unit/auth.test.js > Auth Module > login() > should use current URL when nextUrl is not provided: src/modules/analytics.ts#L258
ReferenceError: document is not defined ❯ trackInitializationEvent src/modules/analytics.ts:258:17 ❯ Module.createAnalyticsModule src/modules/analytics.ts:186:3 ❯ Module.createClient src/client.ts:159:16 ❯ tests/unit/auth.test.js:13:14
tests/unit/auth.test.js > Auth Module > login() > should redirect to login page with correct URL in browser environment: src/modules/auth.ts#L47
TypeError: Cannot read properties of undefined (reading 'startsWith') ❯ Object.redirectToLogin src/modules/auth.ts:47:34 ❯ tests/unit/auth.test.js:148:19