Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(frontend): fix root causes of jest test output noise (#68892)

Marius Andraeaeb4a8de566
diff --git a/frontend/bin/ci-report/update-ci-report.test.ts b/frontend/bin/ci-report/update-ci-report.test.ts
index 027ed025d2d6..582a7d5edf45 100644
--- a/frontend/bin/ci-report/update-ci-report.test.ts
+++ b/frontend/bin/ci-report/update-ci-report.test.ts
@@ -42,6 +42,16 @@ function legacyComment(summary: string, body = 'old body'): string {
}
describe('ci-report section helper', () => {
+ // The script narrates its progress to the CI job log via console.info/warn;
+ // exercising it in jest would dump that narration into the test output.
+ beforeEach(() => {
+ jest.spyOn(console, 'info').mockImplementation(() => {})
+ jest.spyOn(console, 'warn').mockImplementation(() => {})
+ })
+ afterEach(() => {
+ jest.restoreAllMocks()
+ })
+
it('renders collapsed section blocks in fixed registry order regardless of write order', () => {
// Written eager-graph -> dist-size -> bundle-size; registry order is the reverse.
const rendered: string = renderComment(
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index fa297a2422ea..b93851e0f1e6 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5833,9 +5833,9 @@ snapshots:
scenes-app-insights-boldnumber--empty-result--light:
hash: v1.k794b7964.65e70353ad3bde71b0e2cdc5200bd12bc4212d7ed2e2f5685b4f3c658100ebab.aQZAzvjy49GuPtTh6egEvczvfX-AXbu-FWl4tgtjqtY
scenes-app-insights-error-empty-states--empty--dark:
- hash: v1.k794b7964.9ee0ff343b06a349b856cc96df34502e79b596f75ad8b004e4adfba0d8a5173e.0p7VrIpDMrTmgL58deU1SFCIYYxBztKoxSxl1HOzHdE
+ hash: v1.k794b7964.76b9de5735e998cd0643b9122af225ede95128f8d1087f438a8f13179a2cd314.j-ZaK3wWdoYedOoS0uqock8iOi4qHvyFl7W8j59NzPM
scenes-app-insights-error-empty-states--empty--light:
- hash: v1.k794b7964.d284a21a59e6564df253d79739250ed412b284bb31578918a8694bc094e626ac.IIcUtgJiU1RA4nNt9HLxmM3yT4SO_pGPdQqE-Ewj3NI
+ hash: v1.k794b7964.43e8dc4bf97bb67ddaf60c572621f44670e53ae5e49adc85129ce56fe34112c2.sbomFpq1C6A2uPO2QNzFMa2oPgeAiU2Y6lNYz6qH_dc
scenes-app-insights-error-empty-states--estimated-query-execution-time-too-long--dark:
hash: v1.k794b7964.48716a48b2caaeeeca99f6223c47d9509d443b7a54b75ba3264d4d48c6b10fc2.qfYybMOhpeaoivbNtF0AYxe9-sbO8hjM9sVEwkZsSyo
scenes-app-insights-error-empty-states--estimated-query-execution-time-too-long--light:
@@ -5853,13 +5853,13 @@ snapshots:
scenes-app-insights-error-empty-states--query-server-error--light:
hash: v1.k794b7964.4fd0ad961c340f6a29de2b3026e4359724a2760a6c116dbb44084141d4312583.E7-256CCFJuc8LtP4L3NXFwms9PNH3aYu6c36e1OIzE
scenes-app-insights-error-empty-states--server-error--dark:
- hash: v1.k794b7964.9ee0ff343b06a349b856cc96df34502e79b596f75ad8b004e4adfba0d8a5173e.wYfk20hxvL63M2S9Gz9twBJqXYBLBgcu2-ZASDRHTvI
+ hash: v1.k794b7964.256531339cd2dcd1bc37e23faa2ed005422f6a96d0f5ce68e032c5a5add4a24e.Izm9NrjX1PPmPZ0d0Cp_xzToZV_1DvVuIq51nxvJqsw
scenes-app-insights-error-empty-states--server-error--light:
- hash: v1.k794b7964.d284a21a59e6564df253d79739250ed412b284bb31578918a8694bc094e626ac.F87uLtXlZLXl01OiNum1cEYhzW-kiUgw6q5R5wKTpSo
+ hash: v1.k794b7964.1680374542e6c9dee3cedcaa28bdd0cb4797a74d7c836b27b6aee6bb4c968547.3hC0bm_bygQVOuMig0V_O8uB-pM3FCBCSLsiLYDroB8
scenes-app-insights-error-empty-states--validation-error--dark:
- hash: v1.k794b7964.9ee0ff343b06a349b856cc96df34502e79b596f75ad8b004e4adfba0d8a5173e.e5tGYl2cYrCxl_YNy5Scm0pNtVsQ77D6NBAZOOUXNc4
+ hash: v1.k794b7964.855cdd3fac12fc2645b90ff17a8e0150f3cd4e4b646e92b9266e5261459d0d07.yF2PxdOOktpjWsHaPmDXsmLxgz5S3nhheVXgr1Xt1V0
scenes-app-insights-error-empty-states--validation-error--light:
- hash: v1.k794b7964.d284a21a59e6564df253d79739250ed412b284bb31578918a8694bc094e626ac.8ao-jZcMAtmcmyjNOnZ8a5N4kcakxGGzK0i8YzbG-qA
+ hash: v1.k794b7964.e232ea060b03d0822779abbb60dcc292ef83dd8b5ffc76ce3f07078793c0385c.iF5uqRK20wurdp2qDmMgridMiGRNah0j1gTzHZiP5XE
scenes-app-insights-funnels--funnel-historical-trends--dark:
hash: v1.k794b7964.9d3d149846cd60d1d3189cb9ad23437d0425b608508133b065f279f2dcd258aa._NdKzrFXPdclDkWtsQVja0DDXbOIJRI-S0g5n1bd_tg
scenes-app-insights-funnels--funnel-historical-trends--light:
diff --git a/frontend/src/initKea.ts b/frontend/src/initKea.ts
index dd4c47f66d96..869f311c6487 100644
--- a/frontend/src/initKea.ts
+++ b/frontend/src/initKea.ts
@@ -93,6 +93,11 @@ export function initKea({
formsPlugin,
loadersPlugin({
onFailure({ error, reducerKey, actionKey }: { error: any; reducerKey: string; actionKey: string }) {
+ // A request aborted by us (superseded query, unmount, manual cancel) is not a
+ // failure — don't toast, log, or report it.
+ if (error?.name === 'AbortError') {
+ return
+ }
// Read-only mode (`ReadOnlyModeError`) flows through this path unchanged:
// it extends `ApiError` with `status=403`, so the `!(isLoadAction && error.status === 403)`
// condition already suppresses the toast for load actions, and write actions
diff --git a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.selectingKeyOnly.test.tsx b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.selectingKeyOnly.test.tsx
index 69e28831b02f..5b47525551f8 100644
--- a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.selectingKeyOnly.test.tsx
+++ b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.selectingKeyOnly.test.tsx
@@ -8,7 +8,14 @@ import { COHORTS_ONLY_SUPPORT_IN_PICKER_PROPS } from 'scenes/feature-flags/cohor
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
import { mockGetEventDefinitions, mockGetPropertyDefinitions } from '~/test/mocks'
-import { CohortPropertyFilter, CohortType, EventPropertyFilter, PropertyFilterType, PropertyOperator } from '~/types'
+import {
+ CohortPropertyFilter,
+ CohortType,
+ EventPropertyFilter,
+ FilterLogicalOperator,
+ PropertyFilterType,
+ PropertyOperator,
+} from '~/types'
import { TaxonomicFilterGroupType } from '../../TaxonomicFilter/types'
import { PropertyFilters } from '../PropertyFilters'
@@ -18,7 +25,11 @@ jest.mock('lib/components/AutoSizer', () => ({
renderProp({ height: 400, width: 400 }),
}))
-const cohortPowerUsers: Partial<CohortType> = { id: 1, name: 'Power Users' }
+const cohortPowerUsers: Partial<CohortType> = {
+ id: 1,
+ name: 'Power Users',
+ filters: { properties: { type: FilterLogicalOperator.And, values: [] } },
+}
describe('TaxonomicPropertyFilter selectingKeyOnly', () => {
beforeEach(() => {
diff --git a/frontend/src/lib/components/TaxonomicFilter/headless/headless.test.tsx b/frontend/src/lib/components/TaxonomicFilter/headless/headless.test.tsx
index f22954934fff..867df89e26a9 100644
--- a/frontend/src/lib/components/TaxonomicFilter/headless/headless.test.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/headless/headless.test.tsx
@@ -9,6 +9,7 @@ import { actionsModel } from '~/models/actionsModel'
import { groupsModel } from '~/models/groupsModel'
import { performQuery } from '~/queries/query'
import { initKeaTests } from '~/test/init'
+import { emptyPaginated } from '~/test/mocks/taxonomicFilterApiMock'
import { PropertyFilterType, PropertyOperator } from '~/types'
import { __clearTaxonomicResourceCache } from '../hooks/useTaxonomicResource'
@@ -20,12 +21,9 @@ jest.mock('~/queries/query', () => ({
performQuery: jest.fn(),
}))
-jest.mock('lib/api', () => ({
- __esModule: true,
- default: {
- get: jest.fn(),
- },
-}))
+jest.mock('lib/api', () =>
+ require('~/test/mocks/taxonomicFilterApiMock').buildTaxonomicFilterApiMock({ get: jest.fn() })
+)
const apiGet = jest.requireMock('lib/api').default.get as jest.MockedFunction<any>
@@ -36,6 +34,7 @@ describe('TaxonomicFilterHeadless integration', () => {
beforeEach(() => {
__clearTaxonomicResourceCache()
apiGet.mockReset()
+ apiGet.mockImplementation(emptyPaginated)
;(performQuery as jest.Mock).mockResolvedValue({ tables: {}, joins: [] })
useMocks({
get: { '/api/projects/:team/event_definitions': { results: [], count: 0 } },
diff --git a/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.test.tsx b/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.test.tsx
index fb60151ce09b..9aa21655f7b1 100644
--- a/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.test.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.test.tsx
@@ -16,10 +16,11 @@ jest.mock('~/queries/query', () => ({
performQuery: jest.fn(),
}))
-jest.mock('lib/api', () => ({
- __esModule: true,
- default: { get: jest.fn().mockResolvedValue({ results: [], count: 0 }) },
-}))
+jest.mock('lib/api', () =>
+ require('~/test/mocks/taxonomicFilterApiMock').buildTaxonomicFilterApiMock({
+ get: jest.fn().mockResolvedValue({ results: [], count: 0 }),
+ })
+)
const wrapper = ({ children }: { children: ReactNode }): JSX.Element => <Provider>{children}</Provider>
diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx
index 0eab232be7a6..c8762136d8ae 100644
--- a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx
@@ -10,6 +10,7 @@ import { actionsModel } from '~/models/actionsModel'
import { groupsModel } from '~/models/groupsModel'
import { performQuery } from '~/queries/query'
import { initKeaTests } from '~/test/init'
+import { emptyPaginated } from '~/test/mocks/taxonomicFilterApiMock'
import { TaxonomicFilterHeadless } from '../headless'
import { __clearTaxonomicResourceCache } from '../hooks/useTaxonomicResource'
@@ -26,22 +27,7 @@ jest.mock('posthog-js', () => ({
default: { capture: jest.fn() },
}))
-jest.mock('lib/api', () => {
- const emptyPaginated = (): Promise<{ results: any[]; count: number; next: null }> =>
- Promise.resolve({ results: [], count: 0, next: null })
- return {
- __esModule: true,
- default: {
- get: jest.fn().mockImplementation(emptyPaginated),
- actions: { list: jest.fn().mockImplementation(emptyPaginated) },
- dataWarehouseSavedQueries: { list: jest.fn().mockImplementation(emptyPaginated) },
- dataWarehouseTables: { list: jest.fn().mockImplementation(emptyPaginated) },
- queryTabState: { list: jest.fn().mockImplementation(emptyPaginated) },
- dashboards: { list: jest.fn().mockImplementation(emptyPaginated) },
- cohorts: { listPaginated: jest.fn().mockImplementation(emptyPaginated) },
- },
- }
-})
+jest.mock('lib/api', () => require('~/test/mocks/taxonomicFilterApiMock').buildTaxonomicFilterApiMock())
const apiGet = jest.requireMock('lib/api').default.get as jest.MockedFunction<any>
const captureMock = jest.requireMock('posthog-js').default.capture as jest.Mock
@@ -116,6 +102,7 @@ describe('MenuFilterCombobox', () => {
beforeEach(() => {
__clearTaxonomicResourceCache()
apiGet.mockReset()
+ apiGet.mockImplementation(emptyPaginated)
captureMock.mockClear()
;(performQuery as jest.Mock).mockResolvedValue({ tables: {}, joins: [] })
useMocks({})
@@ -583,7 +570,11 @@ describe('MenuFilterCombobox', () => {
if (url.includes('property_definitions')) {
return Promise.resolve({ results: [{ id: 1, name: '$browser' }], count: 1 })
}
- return Promise.resolve([])
+ if (url.includes('events/values')) {
+ return Promise.resolve([])
+ }
+ // Paginated floor for everything else (dashboardsModel & co load on mount)
+ return Promise.resolve({ results: [], count: 0 })
})
// What TaxonomicPopoverMenu builds when reopening an existing
// `$current_url icontains <value>` filter picked via the shortcut.
diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx
index c55c060b70b3..797fcab346bd 100644
--- a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx
@@ -1054,6 +1054,7 @@ export function MenuFilterCombobox({
<Autocomplete.Collection>
{(entry: MenuFilterEntry) => (
<Row
+ key={rowDomId(entry)}
entry={entry}
// Show the category label on mixed-group views (All,
// Recent, Pinned) — those mix items from multiple
diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.inputTrigger.test.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.inputTrigger.test.tsx
index b5d4bff6ebf9..f442c81f0768 100644
--- a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.inputTrigger.test.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.inputTrigger.test.tsx
@@ -9,6 +9,7 @@ import { actionsModel } from '~/models/actionsModel'
import { groupsModel } from '~/models/groupsModel'
import { performQuery } from '~/queries/query'
import { initKeaTests } from '~/test/init'
+import { emptyPaginated } from '~/test/mocks/taxonomicFilterApiMock'
import { TaxonomicFilterHeadless } from '../headless'
import { __clearTaxonomicResourceCache } from '../hooks/useTaxonomicResource'
@@ -24,22 +25,7 @@ jest.mock('posthog-js', () => ({
default: { capture: jest.fn() },
}))
-jest.mock('lib/api', () => {
- const emptyPaginated = (): Promise<{ results: any[]; count: number; next: null }> =>
- Promise.resolve({ results: [], count: 0, next: null })
- return {
- __esModule: true,
- default: {
- get: jest.fn().mockImplementation(emptyPaginated),
- actions: { list: jest.fn().mockImplementation(emptyPaginated) },
- dataWarehouseSavedQueries: { list: jest.fn().mockImplementation(emptyPaginated) },
- dataWarehouseTables: { list: jest.fn().mockImplementation(emptyPaginated) },
- queryTabState: { list: jest.fn().mockImplementation(emptyPaginated) },
- dashboards: { list: jest.fn().mockImplementation(emptyPaginated) },
- cohorts: { listPaginated: jest.fn().mockImplementation(emptyPaginated) },
- },
- }
-})
+jest.mock('lib/api', () => require('~/test/mocks/taxonomicFilterApiMock').buildTaxonomicFilterApiMock())
const apiGet = jest.requireMock('lib/api').default.get as jest.MockedFunction<any>
@@ -63,7 +49,7 @@ describe('TaxonomicFilterMenu input trigger', () => {
beforeEach(() => {
__clearTaxonomicResourceCache()
apiGet.mockReset()
- apiGet.mockResolvedValue({ results: [], count: 0, next: null })
+ apiGet.mockImplementation(emptyPaginated)
;(performQuery as jest.Mock).mockResolvedValue({ tables: {}, joins: [] })
useMocks({})
initKeaTests()
diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx
index 75774be461ce..daa2a97bcf88 100644
--- a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx
@@ -651,6 +651,7 @@ export function TaxonomicFilterMenu({
<DropdownMenuTrigger render={triggerEl} data-attr="taxonomic-filter-menu-trigger" />
)}
<PopoverTrigger
+ nativeButton={false}
render={<span aria-hidden tabIndex={-1} className="absolute inset-0 pointer-events-none" />}
/>
{triggerAccessory}
diff --git a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.inputTrigger.test.tsx b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.inputTrigger.test.tsx
index 299bec9a6f31..41cabe25fd6a 100644
--- a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.inputTrigger.test.tsx
+++ b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.inputTrigger.test.tsx
@@ -12,6 +12,7 @@ import { actionsModel } from '~/models/actionsModel'
import { groupsModel } from '~/models/groupsModel'
import { performQuery } from '~/queries/query'
import { initKeaTests } from '~/test/init'
+import { emptyPaginated } from '~/test/mocks/taxonomicFilterApiMock'
import { TaxonomicPopoverMenu } from './TaxonomicPopoverMenu'
@@ -24,22 +25,7 @@ jest.mock('posthog-js', () => ({
default: { capture: jest.fn() },
}))
-jest.mock('lib/api', () => {
- const emptyPaginated = (): Promise<{ results: any[]; count: number; next: null }> =>
- Promise.resolve({ results: [], count: 0, next: null })
- return {
- __esModule: true,
- default: {
- get: jest.fn().mockImplementation(emptyPaginated),
- actions: { list: jest.fn().mockImplementation(emptyPaginated) },
- dataWarehouseSavedQueries: { list: jest.fn().mockImplementation(emptyPaginated) },
- dataWarehouseTables: { list: jest.fn().mockImplementation(emptyPaginated) },
- queryTabState: { list: jest.fn().mockImplementation(emptyPaginated) },
- dashboards: { list: jest.fn().mockImplementation(emptyPaginated) },
- cohorts: { listPaginated: jest.fn().mockImplementation(emptyPaginated) },
- },
- }
-})
+jest.mock('lib/api', () => require('~/test/mocks/taxonomicFilterApiMock').buildTaxonomicFilterApiMock())
const apiGet = jest.requireMock('lib/api').default.get as jest.MockedFunction<any>
@@ -60,7 +46,7 @@ describe('TaxonomicPopoverMenu input trigger (lazy placeholder)', () => {
beforeEach(() => {
__clearTaxonomicResourceCache()
apiGet.mockReset()
- apiGet.mockResolvedValue({ results: [], count: 0, next: null })
+ apiGet.mockImplementation(emptyPaginated)
;(performQuery as jest.Mock).mockResolvedValue({ tables: {}, joins: [] })
useMocks({})
initKeaTests()
diff --git a/frontend/src/lib/lemon-ui/LemonModal/LemonModal.tsx b/frontend/src/lib/lemon-ui/LemonModal/LemonModal.tsx
index 1069d100bf16..19d74cd74a3c 100644
--- a/frontend/src/lib/lemon-ui/LemonModal/LemonModal.tsx
+++ b/frontend/src/lib/lemon-ui/LemonModal/LemonModal.tsx
@@ -205,7 +205,12 @@ export function LemonModal({
maxWidth,
},
}}
- appElement={document.getElementById('root') as HTMLElement}
+ // Aria-hide the app behind the modal only when the app root exists. Without it
+ // (jsdom tests, embedded contexts) there is nothing to hide that doesn't also
+ // contain the modal portal itself — hiding `document.body` would remove the modal
+ // from the accessibility tree too.
+ appElement={document.getElementById('root') ?? document.body}
+ ariaHideApp={document.getElementById('root') !== null}
contentRef={contentRef}
overlayRef={overlayRef}
parentSelector={floatingContainer ? () => floatingContainer : undefined}
diff --git a/frontend/src/lib/logic/scenes/urlChangeTracker.ts b/frontend/src/lib/logic/scenes/urlChangeTracker.ts
index f7fa09c9f419..7f913cccdd43 100644
--- a/frontend/src/lib/logic/scenes/urlChangeTracker.ts
+++ b/frontend/src/lib/logic/scenes/urlChangeTracker.ts
@@ -191,6 +191,11 @@ export function captureRapidUrlChangeWarning(
}
export function trackUrlChange(response: ActionToUrlResponse, logicPath: string, actionName: string): void {
+ // The rapid-change threshold assumes human pacing in a real browser; jest tests
+ // legitimately navigate many times per second, so the heuristic can only false-positive there.
+ if (process.env.NODE_ENV === 'test') {
+ return
+ }
try {
const urlString = extractUrlString(response)
if (urlString === null) {
diff --git a/frontend/src/mocks/handlers.ts b/frontend/src/mocks/handlers.ts
index 01e26a4a8f89..08124878b13e 100644
--- a/frontend/src/mocks/handlers.ts
+++ b/frontend/src/mocks/handlers.ts
@@ -297,11 +297,11 @@ export const defaultMocks: Mocks = {
'/decide/': posthogCORSResponse,
'/flags/': posthogCORSResponse,
'https://us.i.posthog.com/engage/': posthogCORSResponse,
- '/api/environments/:team_id/query/': [200, { results: [] }],
- '/api/environments/:team_id/query/:query_kind/': [200, { results: [] }],
+ '/api/environments/:team_id/query/': { results: [] },
+ '/api/environments/:team_id/query/:query_kind/': { results: [] },
'/api/environments/:team_id/insights/viewed/': () => [201, null],
- 'api/environments/:team_id/query': [200, { results: [] }],
- 'api/environments/:team_id/query/:query_kind/': [200, { results: [] }],
+ 'api/environments/:team_id/query': { results: [] },
+ 'api/environments/:team_id/query/:query_kind/': { results: [] },
'/api/environments/:team_id/file_system/log_view/': {},
},
patch: {
diff --git a/frontend/src/mocks/utils.ts b/frontend/src/mocks/utils.ts
index e73aaf729194..b6d68f0d99ea 100644
--- a/frontend/src/mocks/utils.ts
+++ b/frontend/src/mocks/utils.ts
@@ -52,12 +52,14 @@ export const mocksToHandlers = (mocks: Mocks): HttpHandler[] => {
const pathWithoutTrailingSlash = path.replace(/\/$/, '')
handlers.push(
(http[method] as (typeof http)['get'])(pathWithoutTrailingSlash, async (info) => {
- // A function handler returns one of the MockResult forms (sync or async);
- // any other value is a static JSON body (arrays serialized as-is, matching v1).
+ // Function handlers and static values support the same MockResult forms:
+ // a `[status, body]` tuple, a Response, or a plain JSON body. Static
+ // `[status, body]` tuples used to be serialized as a literal array body,
+ // which silently broke every mock relying on the status.
if (typeof handler === 'function') {
return toResponse(await handler(info))
}
- return HttpResponse.json((handler as DefaultBodyType) ?? null)
+ return toResponse(handler as MockResult)
})
)
})
diff --git a/frontend/src/scenes/experiments/experimentsLogic.test.ts b/frontend/src/scenes/experiments/experimentsLogic.test.ts
index 1b6de6f87b70..530c84ffc329 100644
--- a/frontend/src/scenes/experiments/experimentsLogic.test.ts
+++ b/frontend/src/scenes/experiments/experimentsLogic.test.ts
@@ -7,6 +7,7 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { NEW_FLAG } from 'scenes/feature-flags/featureFlagLogic'
import { urls } from 'scenes/urls'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { initKeaTests } from '~/test/init'
import { Experiment, ExperimentStatus, ExperimentsTabs, FeatureFlagType } from '~/types'
@@ -51,6 +52,7 @@ const mockDraftExperiment = createMockExperiment({
const mkFlag = (id: number, key: string): FeatureFlagType => ({ ...NEW_FLAG, id, key })
describe('experimentsLogic', () => {
+ afterEach(resumeKeaLoadersErrors)
let logic: ReturnType<typeof experimentsLogic.build>
beforeEach(() => {
@@ -427,6 +429,7 @@ describe('experimentsLogic', () => {
})
it('does not run the copy success callback when the copy fails', async () => {
+ silenceKeaLoadersErrors()
const onSuccess = jest.fn()
api.create.mockRejectedValue(new Error('Permission denied'))
diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts
index 2ae750ae5106..61702b1d2505 100644
--- a/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts
@@ -6,6 +6,7 @@ import { expectLogic, partial } from 'kea-test-utils'
import { dayjs } from 'lib/dayjs'
import { urls } from 'scenes/urls'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
import {
@@ -851,7 +852,6 @@ describe('featureFlagLogic', () => {
const flag = { ...MOCK_FEATURE_FLAG, id: 6, active: true }
const testLogic = featureFlagLogic({ id: 6 })
- testLogic.mount()
useMocks({
get: {
@@ -867,6 +867,8 @@ describe('featureFlagLogic', () => {
},
})
+ testLogic.mount()
+
await expectLogic(testLogic, () => {
testLogic.actions.loadFeatureFlag()
}).toDispatchActions(['loadFeatureFlagSuccess', 'loadDependentFlagsSuccess'])
@@ -883,7 +885,6 @@ describe('featureFlagLogic', () => {
const flag = { ...MOCK_FEATURE_FLAG, id: 4 }
const testLogic = featureFlagLogic({ id: 4 })
- testLogic.mount()
useMocks({
get: {
@@ -899,6 +900,8 @@ describe('featureFlagLogic', () => {
},
})
+ testLogic.mount()
+
await expectLogic(testLogic, () => {
testLogic.actions.loadFeatureFlag()
})
@@ -912,7 +915,6 @@ describe('featureFlagLogic', () => {
const flag = { ...MOCK_FEATURE_FLAG, id: 5 }
const testLogic = featureFlagLogic({ id: 5 })
- testLogic.mount()
useMocks({
get: {
@@ -928,6 +930,8 @@ describe('featureFlagLogic', () => {
},
})
+ testLogic.mount()
+
await expectLogic(testLogic, () => {
testLogic.actions.loadFeatureFlag()
})
@@ -938,10 +942,10 @@ describe('featureFlagLogic', () => {
})
it('handles API failure gracefully and returns empty array', async () => {
+ silenceKeaLoadersErrors()
const flag = { ...MOCK_FEATURE_FLAG, id: 14 }
const testLogic = featureFlagLogic({ id: 14 })
- testLogic.mount()
useMocks({
get: {
@@ -957,6 +961,8 @@ describe('featureFlagLogic', () => {
},
})
+ testLogic.mount()
+
await expectLogic(testLogic, () => {
testLogic.actions.loadFeatureFlag()
})
@@ -964,6 +970,7 @@ describe('featureFlagLogic', () => {
.toMatchValues({ dependentFlags: [], dependentFlagsLoading: false })
testLogic.unmount()
+ resumeKeaLoadersErrors()
})
})
@@ -1149,8 +1156,11 @@ describe('featureFlagLogic', () => {
})
it('returns null when the fetch fails so new flag creation is not blocked', async () => {
+ // The graceful-failure path warns to the console by design.
+ const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {})
useMocks({ get: { [conditionsUrl]: () => [500, {}] } })
await expect(resolveDefaultReleaseConditions(null, MOCK_DEFAULT_PROJECT.id)).resolves.toBeNull()
+ warnSpy.mockRestore()
})
})
})
@@ -1339,6 +1349,18 @@ describe('variant reordering', () => {
let logic: ReturnType<typeof featureFlagLogic.build>
beforeEach(() => {
+ useMocks({
+ get: {
+ [`/api/projects/${MOCK_DEFAULT_PROJECT.id}/feature_flags/${MOCK_FEATURE_FLAG.id}/`]: () => [
+ 200,
+ MOCK_FEATURE_FLAG,
+ ],
+ [`/api/projects/${MOCK_DEFAULT_PROJECT.id}/feature_flags/${MOCK_FEATURE_FLAG.id}/status`]: () => [
+ 200,
+ MOCK_FEATURE_FLAG_STATUS,
+ ],
+ },
+ })
initKeaTests()
logic = featureFlagLogic({ id: 1 })
logic.mount()
diff --git a/frontend/src/scenes/heatmaps/__mocks__/heatmapResults.json b/frontend/src/scenes/heatmaps/__mocks__/heatmapResults.json
deleted file mode 100644
index cd6e9eca12f1..000000000000
--- a/frontend/src/scenes/heatmaps/__mocks__/heatmapResults.json
+++ /dev/null
@@ -1,382 +0,0 @@
-{
- "results": [
- {
- "count": 1,
- "pointer_y": 1280,
- "pointer_relative_x": 0.09,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 592,
- "pointer_relative_x": 0.09,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 1168,
- "pointer_relative_x": 0.74,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 96,
- "pointer_relative_x": 0.11,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 448,
- "pointer_relative_x": 0.17,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 432,
- "pointer_relative_x": 0.07,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 96,
- "pointer_relative_x": 0.75,
- "pointer_target_fixed": false
- },
- {
- "count": 3,
- "pointer_y": 1136,
- "pointer_relative_x": 0.94,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 560,
- "pointer_relative_x": 0.97,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 128,
- "pointer_relative_x": 0.26,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 400,
- "pointer_relative_x": 0.17,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 80,
- "pointer_relative_x": 1.1,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 272,
- "pointer_relative_x": 0.26,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 16,
- "pointer_relative_x": 0.04,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 464,
- "pointer_relative_x": 0.14,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 448,
- "pointer_relative_x": 0.2,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 112,
- "pointer_relative_x": 0.06,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 240,
- "pointer_relative_x": 0.62,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 592,
- "pointer_relative_x": 0.31,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 144,
- "pointer_relative_x": 0.03,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 384,
- "pointer_relative_x": 0.22,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 192,
- "pointer_relative_x": 0.76,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 1168,
- "pointer_relative_x": 0.92,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 1168,
- "pointer_relative_x": 0.91,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 176,
- "pointer_relative_x": 0.1,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 1136,
- "pointer_relative_x": 0.99,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 144,
- "pointer_relative_x": 0.11,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 208,
- "pointer_relative_x": 0.07,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 624,
- "pointer_relative_x": 0.32,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 368,
- "pointer_relative_x": 0.25,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 368,
- "pointer_relative_x": 0.18,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 48,
- "pointer_relative_x": 0.11,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 16,
- "pointer_relative_x": 0.97,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 128,
- "pointer_relative_x": 0.22,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 720,
- "pointer_relative_x": 0.94,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 528,
- "pointer_relative_x": 0.03,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 80,
- "pointer_relative_x": 0.09,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 128,
- "pointer_relative_x": 0.28,
- "pointer_target_fixed": false
- },
- {
- "count": 2,
- "pointer_y": 528,
- "pointer_relative_x": 0.01,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 144,
- "pointer_relative_x": 0.27,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 176,
- "pointer_relative_x": 0.82,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 1280,
- "pointer_relative_x": 0.16,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 416,
- "pointer_relative_x": 0.03,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 784,
- "pointer_relative_x": 0.92,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 2624,
- "pointer_relative_x": 0.12,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 2544,
- "pointer_relative_x": 0.18,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 16,
- "pointer_relative_x": 0.24,
- "pointer_target_fixed": false
- },
- {
- "count": 3,
- "pointer_y": 1184,
- "pointer_relative_x": 0.94,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 128,
- "pointer_relative_x": 0.54,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 1120,
- "pointer_relative_x": 0.7,
- "pointer_target_fixed": true
- },
- {
- "count": 1,
- "pointer_y": 192,
- "pointer_relative_x": 0.07,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 672,
- "pointer_relative_x": 0.99,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 176,
- "pointer_relative_x": 0.07,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 224,
- "pointer_relative_x": 0.3,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 256,
- "pointer_relative_x": 0.3,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 96,
- "pointer_relative_x": 0.61,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 496,
- "pointer_relative_x": 0.08,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 192,
- "pointer_relative_x": 0.11,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 304,
- "pointer_relative_x": 0.15,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 928,
- "pointer_relative_x": 0.84,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 336,
- "pointer_relative_x": 0.11,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 208,
- "pointer_relative_x": 0.16,
- "pointer_target_fixed": false
- },
- {
- "count": 1,
- "pointer_y": 48,
- "pointer_relative_x": 0.14,
- "pointer_target_fixed": false
- }
- ]
-}
diff --git a/frontend/src/scenes/heatmaps/components/__mocks__/heatmapResults.json b/frontend/src/scenes/heatmaps/components/__mocks__/heatmapResults.json
deleted file mode 100644
index b586b121c70c..000000000000
--- a/frontend/src/scenes/heatmaps/components/__mocks__/heatmapResults.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "results": [
- { "pointer_target_fixed": true, "pointer_relative_x": 0.1, "pointer_y": 120, "count": 8 },
- { "pointer_target_fixed": true, "pointer_relative_x": 0.25, "pointer_y": 320, "count": 15 },
- { "pointer_target_fixed": false, "pointer_relative_x": 0.5, "pointer_y": 540, "count": 22 },
- { "pointer_target_fixed": false, "pointer_relative_x": 0.75, "pointer_y": 720, "count": 12 },
- { "pointer_target_fixed": true, "pointer_relative_x": 0.33, "pointer_y": 260, "count": 18 },
- { "pointer_target_fixed": false, "pointer_relative_x": 0.66, "pointer_y": 460, "count": 9 },
- { "pointer_target_fixed": true, "pointer_relative_x": 0.15, "pointer_y": 180, "count": 5 },
- { "pointer_target_fixed": false, "pointer_relative_x": 0.85, "pointer_y": 900, "count": 7 }
- ]
-}
diff --git a/frontend/src/scenes/insights/EmptyStates/EmptyStates.stories.tsx b/frontend/src/scenes/insights/EmptyStates/EmptyStates.stories.tsx
index 4496eb9d01ba..0c459b587471 100644
--- a/frontend/src/scenes/insights/EmptyStates/EmptyStates.stories.tsx
+++ b/frontend/src/scenes/insights/EmptyStates/EmptyStates.stories.tsx
@@ -61,6 +61,20 @@ export const ServerError: Story = {
)
},
},
+ post: {
+ // The query path must fail like the legacy endpoints above — otherwise the
+ // default query mock succeeds and renders a freshness bar over the error state.
+ '/api/environments/:team_id/query/:kind/': async () => {
+ await delay(100)
+ return HttpResponse.json(
+ {
+ type: 'server_error',
+ detail: 'There is nothing you can do to stop the impending catastrophe.',
+ },
+ { status: 500 }
+ )
+ },
+ },
})
return <App />
@@ -122,6 +136,18 @@ export const ValidationError: Story = {
{ status: 400 }
)
},
+ // Fail the query path too, so the default query mock doesn't succeed and
+ // render a freshness bar over the error state.
+ '/api/environments/:team_id/query/:kind/': async () => {
+ await delay(100)
+ return HttpResponse.json(
+ {
+ type: 'validation_error',
+ detail: 'You forgot to hug the person next to you. Please do that now.',
+ },
+ { status: 400 }
+ )
+ },
},
})
diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodePersonFeed/notebookNodePersonFeedLogic.test.ts b/frontend/src/scenes/notebooks/Nodes/NotebookNodePersonFeed/notebookNodePersonFeedLogic.test.ts
index db6be0c6fbec..196de0e21810 100644
--- a/frontend/src/scenes/notebooks/Nodes/NotebookNodePersonFeed/notebookNodePersonFeedLogic.test.ts
+++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodePersonFeed/notebookNodePersonFeedLogic.test.ts
@@ -5,6 +5,7 @@ import { expectLogic } from 'kea-test-utils'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { SessionSummaryContent } from 'scenes/session-recordings/player/player-meta/types'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -132,6 +133,11 @@ const mockFailingSessions = [
const failingSessionIds = ['session-4', 'session-5']
describe('notebookNodePersonFeedLogic', () => {
+ // The suite deliberately mixes failing sessions (session-4/5 return 500s) into
+ // most tests to exercise summarization failure handling — skip the loader logging.
+ beforeAll(silenceKeaLoadersErrors)
+ afterAll(resumeKeaLoadersErrors)
+
let logic: ReturnType<typeof notebookNodePersonFeedLogic.build>
const mountLogic = async (): Promise<void> => {
diff --git a/frontend/src/scenes/persons/personsLogic.test.ts b/frontend/src/scenes/persons/personsLogic.test.ts
index 35a8c12000e2..e88ca72dee21 100644
--- a/frontend/src/scenes/persons/personsLogic.test.ts
+++ b/frontend/src/scenes/persons/personsLogic.test.ts
@@ -5,6 +5,7 @@ import { expectLogic } from 'kea-test-utils'
import api from 'lib/api'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { useMocks } from '~/mocks/jest'
import { MockSignature } from '~/mocks/utils'
import { DataTableNode, NodeKind } from '~/queries/schema/schema-general'
@@ -14,6 +15,7 @@ import { PersonsTabType, PersonType, PropertyFilterType, PropertyOperator } from
import { personsLogic } from './personsLogic'
describe('personsLogic', () => {
+ afterEach(resumeKeaLoadersErrors)
let logic: ReturnType<typeof personsLogic.build>
const mockPersonsApiHandler: MockSignature = ({ request }) => {
@@ -145,6 +147,7 @@ describe('personsLogic', () => {
describe('loadPersonUUID error handling', () => {
it('surfaces a genuine load failure as personError', async () => {
+ silenceKeaLoadersErrors()
jest.spyOn(api, 'query').mockRejectedValueOnce(new Error('boom'))
await expectLogic(logic, () => {
diff --git a/frontend/src/scenes/persons/relatedFeatureFlagsLogic.test.ts b/frontend/src/scenes/persons/relatedFeatureFlagsLogic.test.ts
index daf953926700..56f77fd9c400 100644
--- a/frontend/src/scenes/persons/relatedFeatureFlagsLogic.test.ts
+++ b/frontend/src/scenes/persons/relatedFeatureFlagsLogic.test.ts
@@ -3,7 +3,7 @@ import { MOCK_DEFAULT_PROJECT } from 'lib/api.mock'
import { expectLogic } from 'kea-test-utils'
import { NEW_FLAG } from 'scenes/feature-flags/featureFlagLogic'
-import { FeatureFlagsFilters, featureFlagsLogic } from 'scenes/feature-flags/featureFlagsLogic'
+import { featureFlagsLogic } from 'scenes/feature-flags/featureFlagsLogic'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -62,29 +62,29 @@ describe('relatedFeatureFlagsLogic', () => {
})
describe('server-side filtering', () => {
- const setupMocks = (filters?: FeatureFlagsFilters): void => {
- const queryParams = filters ? `?${new URLSearchParams(filters as any).toString()}` : ''
-
- // Filter flags based on provided filters
- let filteredFlags = [...MOCK_FLAGS]
- if (filters?.active !== undefined) {
- const isActive = filters.active === 'true'
- filteredFlags = filteredFlags.filter((flag) => flag.active === isActive)
- }
- if (filters?.type) {
- if (filters.type === 'boolean') {
- filteredFlags = filteredFlags.filter((flag) => !flag.filters.multivariate?.variants?.length)
- } else if (filters.type === 'multivariant') {
- filteredFlags = filteredFlags.filter((flag) => !!flag.filters.multivariate?.variants?.length)
- }
- }
-
+ // One handler that filters by the request's actual query params — MSW ignores
+ // query strings in handler URLs, so pre-baked per-filter handlers never keyed
+ // off the params anyway.
+ const setupMocks = (): void => {
// oxlint-disable-next-line react-hooks/rules-of-hooks
useMocks({
get: {
- [`/api/projects/${MOCK_DEFAULT_PROJECT.id}/feature_flags/${queryParams}`]: {
- results: filteredFlags,
- count: filteredFlags.length,
+ [`/api/projects/${MOCK_DEFAULT_PROJECT.id}/feature_flags/`]: ({ request }) => {
+ const params = new URL(request.url).searchParams
+ const active = params.get('active')
+ const type = params.get('type')
+ let filteredFlags = [...MOCK_FLAGS]
+ if (active !== null) {
+ filteredFlags = filteredFlags.filter((flag) => flag.active === (active === 'true'))
+ }
+ if (type === 'boolean') {
+ filteredFlags = filteredFlags.filter((flag) => !flag.filters.multivariate?.variants?.length)
+ } else if (type === 'multivariant') {
+ filteredFlags = filteredFlags.filter(
+ (flag) => !!flag.filters.multivariate?.variants?.length
+ )
+ }
+ return [200, { results: filteredFlags, count: filteredFlags.length }]
},
[`/api/projects/${MOCK_DEFAULT_PROJECT.id}/feature_flags/evaluation_reasons`]:
MOCK_EVALUATION_REASONS,
@@ -101,8 +101,6 @@ describe('relatedFeatureFlagsLogic', () => {
})
it('should filter flags by type=boolean on server side', async () => {
- setupMocks({ type: 'boolean', page: 1 })
-
await expectLogic(logic, () => {
logic.actions.setFilters({ type: FeatureFlagReleaseType.ReleaseToggle })
}).toFinishAllListeners()
@@ -117,8 +115,6 @@ describe('relatedFeatureFlagsLogic', () => {
})
it('should filter flags by type=multivariant on server side', async () => {
- setupMocks({ type: 'multivariant', page: 1 })
-
await expectLogic(logic, () => {
logic.actions.setFilters({ type: FeatureFlagReleaseType.Variants })
}).toFinishAllListeners()
@@ -133,8 +129,6 @@ describe('relatedFeatureFlagsLogic', () => {
})
it('should filter flags by active=true on server side', async () => {
- setupMocks({ active: 'true', page: 1 })
-
await expectLogic(logic, () => {
logic.actions.setFilters({ active: 'true' })
}).toFinishAllListeners()
@@ -148,8 +142,6 @@ describe('relatedFeatureFlagsLogic', () => {
})
it('should filter flags by active=false on server side', async () => {
- setupMocks({ active: 'false', page: 1 })
-
await expectLogic(logic, () => {
logic.actions.setFilters({ active: 'false' })
}).toFinishAllListeners()
@@ -162,8 +154,6 @@ describe('relatedFeatureFlagsLogic', () => {
})
it('should combine multiple filters', async () => {
- setupMocks({ type: 'boolean', active: 'true', page: 1 })
-
await expectLogic(logic, () => {
logic.actions.setFilters({ type: FeatureFlagReleaseType.ReleaseToggle, active: 'true' })
}).toFinishAllListeners()
@@ -175,12 +165,10 @@ describe('relatedFeatureFlagsLogic', () => {
})
it('should clear type filter when replace=true and type not in new filters', async () => {
- setupMocks({ type: 'boolean', active: 'true', page: 1 })
await expectLogic(logic, () => {
logic.actions.setFilters({ type: FeatureFlagReleaseType.ReleaseToggle, active: 'true' })
}).toFinishAllListeners()
- setupMocks({ active: 'true', page: 1 })
await expectLogic(logic, () => {
logic.actions.setFilters({ active: 'true' }, true)
}).toFinishAllListeners()
diff --git a/frontend/src/scenes/session-recordings/mobile-replay/__mocks__/encoded-snapshot-data.ts b/frontend/src/scenes/session-recordings/mobile-replay/__mocks__/encoded-mobile-snapshot-data.ts
similarity index 100%
rename from frontend/src/scenes/session-recordings/mobile-replay/__mocks__/encoded-snapshot-data.ts
rename to frontend/src/scenes/session-recordings/mobile-replay/__mocks__/encoded-mobile-snapshot-data.ts
diff --git a/frontend/src/scenes/session-recordings/mobile-replay/parsing.test.ts b/frontend/src/scenes/session-recordings/mobile-replay/parsing.test.ts
index d43d48a66640..cba7d4bb7fe6 100644
--- a/frontend/src/scenes/session-recordings/mobile-replay/parsing.test.ts
+++ b/frontend/src/scenes/session-recordings/mobile-replay/parsing.test.ts
@@ -2,7 +2,7 @@ import { keyForSource, processAllSnapshots } from '@posthog/replay-shared'
import { parseEncodedSnapshots } from 'scenes/session-recordings/player/snapshot-processing/process-all-snapshots'
-import { encodedWebSnapshotData } from './__mocks__/encoded-snapshot-data'
+import { encodedWebSnapshotData } from './__mocks__/encoded-mobile-snapshot-data'
describe('snapshot parsing', () => {
const sessionId = '12345'
diff --git a/frontend/src/scenes/settings/environment/maxSettingsLogic.test.ts b/frontend/src/scenes/settings/environment/maxSettingsLogic.test.ts
index 6c78677c5fd6..72ab013ab9ed 100644
--- a/frontend/src/scenes/settings/environment/maxSettingsLogic.test.ts
+++ b/frontend/src/scenes/settings/environment/maxSettingsLogic.test.ts
@@ -2,12 +2,14 @@ import { expectLogic } from 'kea-test-utils'
import api from 'lib/api'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
import { maxSettingsLogic } from './maxSettingsLogic'
describe('maxSettingsLogic', () => {
+ afterEach(resumeKeaLoadersErrors)
let logic: ReturnType<typeof maxSettingsLogic.build>
beforeEach(() => {
@@ -56,6 +58,7 @@ describe('maxSettingsLogic', () => {
)
it('lets non-HTTP errors propagate so real regressions stay visible', async () => {
+ silenceKeaLoadersErrors()
// A programming error (not an ApiError) should surface as a failure, not be silently swallowed.
jest.spyOn(api.coreMemory, 'list').mockRejectedValueOnce(new TypeError('boom'))
logic = maxSettingsLogic()
diff --git a/frontend/src/scenes/surveys/surveyLogic.test.ts b/frontend/src/scenes/surveys/surveyLogic.test.ts
index c3e9b9913e0f..95ec3ba3cb22 100644
--- a/frontend/src/scenes/surveys/surveyLogic.test.ts
+++ b/frontend/src/scenes/surveys/surveyLogic.test.ts
@@ -1582,10 +1582,19 @@ describe('survey filters', () => {
describe('URL parameter synchronization', () => {
let logic: ReturnType<typeof surveyLogic.build>
- beforeEach(() => {
+ beforeEach(async () => {
+ useMocks({
+ get: {
+ [`/api/projects/:team/surveys/${MULTIPLE_CHOICE_SURVEY.id}/`]: () => [200, MULTIPLE_CHOICE_SURVEY],
+ [`/api/projects/:team/surveys/${MULTIPLE_CHOICE_SURVEY.id}/archived-response-uuids/`]: () => [200, []],
+ },
+ })
initKeaTests()
logic = surveyLogic({ id: MULTIPLE_CHOICE_SURVEY.id })
logic.mount()
+ // loadSurvey fires on mount (with a breakpoint); let it settle inside the test
+ // so it doesn't resolve after the kea context is reset.
+ await expectLogic(logic).toFinishAllListeners()
})
it('only includes non-empty filters in URL', async () => {
@@ -1819,10 +1828,20 @@ describe('survey stats calculation', () => {
total_count_only_seen: totalCountOnlySeen,
})
- beforeEach(() => {
+ beforeEach(async () => {
+ useMocks({
+ get: {
+ [`/api/projects/:team/surveys/${MOCK_SURVEY_ID}/`]: () => [
+ 200,
+ { ...MULTIPLE_CHOICE_SURVEY, id: MOCK_SURVEY_ID },
+ ],
+ [`/api/projects/:team/surveys/${MOCK_SURVEY_ID}/archived-response-uuids/`]: () => [200, []],
+ },
+ })
initKeaTests()
logic = surveyLogic({ id: MOCK_SURVEY_ID })
logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
})
it('should return null stats and zero rates when no base stats results', async () => {
diff --git a/frontend/src/scenes/userLogic.test.ts b/frontend/src/scenes/userLogic.test.ts
index c62089fd5818..cd3d269a4929 100644
--- a/frontend/src/scenes/userLogic.test.ts
+++ b/frontend/src/scenes/userLogic.test.ts
@@ -5,6 +5,7 @@ import posthog from 'posthog-js'
import api from 'lib/api'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -189,6 +190,9 @@ describe('userLogic', () => {
})
describe('updateUser failure handling', () => {
+ beforeEach(silenceKeaLoadersErrors)
+ afterEach(resumeKeaLoadersErrors)
+
afterEach(() => {
jest.restoreAllMocks()
})
diff --git a/frontend/src/test/mocks/reactMarkdownMock.js b/frontend/src/test/mocks/reactMarkdownMock.js
index cc446c17bec0..b3cb200f086f 100644
--- a/frontend/src/test/mocks/reactMarkdownMock.js
+++ b/frontend/src/test/mocks/reactMarkdownMock.js
@@ -9,7 +9,5 @@ function ReactMarkdown({ children }) {
return React.createElement('div', { 'data-testid': 'react-markdown' }, children)
}
-ReactMarkdown.defaultProps = {}
-
module.exports = ReactMarkdown
module.exports.default = ReactMarkdown
diff --git a/frontend/src/test/mocks/taxonomicFilterApiMock.ts b/frontend/src/test/mocks/taxonomicFilterApiMock.ts
new file mode 100644
index 000000000000..126f3d393d44
--- /dev/null
+++ b/frontend/src/test/mocks/taxonomicFilterApiMock.ts
@@ -0,0 +1,40 @@
+/**
+ * Partial `lib/api` mock for component tests that render the TaxonomicFilter tree.
+ *
+ * Mounting the taxonomic filter pulls in models whose afterMount loaders call
+ * namespaced `api.*` methods (actionsModel, cohortsModel, dataWarehouseViewsLogic,
+ * joinsLogic, surveyQuestionLabelsLogic, ...). A hand-rolled partial mock that
+ * misses one namespace makes those loaders throw on every mount, and kea-loaders
+ * dumps each failure to the console. Keep the namespace floor complete here;
+ * tests override individual methods via `jest.requireMock('lib/api')`.
+ *
+ * Response shapes mirror the real `lib/api` methods so loaders that destructure
+ * (`response.results`, `response.labels`, ...) resolve cleanly to empty data.
+ */
+
+type PaginatedResponse = { results: unknown[]; count: number; next: null }
+
+export const emptyPaginated = (): Promise<PaginatedResponse> => Promise.resolve({ results: [], count: 0, next: null })
+
+export function buildTaxonomicFilterApiMock(overrides: Record<string, unknown> = {}): {
+ __esModule: boolean
+ default: Record<string, unknown>
+} {
+ return {
+ __esModule: true,
+ default: {
+ get: jest.fn().mockImplementation(emptyPaginated),
+ actions: { list: jest.fn().mockImplementation(emptyPaginated) },
+ cohorts: { listPaginated: jest.fn().mockImplementation(emptyPaginated) },
+ dashboards: { list: jest.fn().mockImplementation(emptyPaginated) },
+ queryTabState: { list: jest.fn().mockImplementation(emptyPaginated) },
+ dataWarehouseTables: { list: jest.fn().mockImplementation(emptyPaginated) },
+ dataWarehouseSavedQueries: { list: jest.fn().mockImplementation(emptyPaginated) },
+ // Returns a plain array, not a paginated envelope
+ dataWarehouseSavedQueryFolders: { list: jest.fn().mockResolvedValue([]) },
+ dataWarehouseViewLinks: { list: jest.fn().mockImplementation(emptyPaginated) },
+ surveys: { questionLabels: jest.fn().mockResolvedValue({ labels: [] }) },
+ ...overrides,
+ },
+ }
+}
diff --git a/frontend/src/toolbar/actions/actionsTabLogic.test.ts b/frontend/src/toolbar/actions/actionsTabLogic.test.ts
index 6ac1d5b71c7b..6a1f2f47d8ad 100644
--- a/frontend/src/toolbar/actions/actionsTabLogic.test.ts
+++ b/frontend/src/toolbar/actions/actionsTabLogic.test.ts
@@ -1,11 +1,18 @@
import { expectLogic } from 'kea-test-utils'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { initKeaTests } from '~/test/init'
import { actionsLogic } from '~/toolbar/actions/actionsLogic'
import { actionsTabLogic } from '~/toolbar/actions/actionsTabLogic'
import { toolbarLogic } from '~/toolbar/bar/toolbarLogic'
import { toolbarConfigLogic } from '~/toolbar/toolbarConfigLogic'
+// The toolbar logger mirrors intentional error/auth paths to the console (its job on
+// customer pages); tests exercise those paths on purpose, so stub the boundary.
+jest.mock('~/toolbar/toolbarLogger', () => ({
+ toolbarLogger: { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn() },
+}))
+
const mockAction = {
id: 42,
name: 'Test Action',
@@ -16,6 +23,11 @@ const mockAction = {
}
describe('actionsTabLogic form submission', () => {
+ // These suites intentionally reject requests to exercise error states; the
+ // failures are asserted via authStatus/values, so skip the global loader logging.
+ beforeAll(silenceKeaLoadersErrors)
+ afterAll(resumeKeaLoadersErrors)
+
let logic: ReturnType<typeof actionsTabLogic.build>
beforeEach(() => {
diff --git a/frontend/src/toolbar/elements/heatmapToolbarMenuLogic.test.ts b/frontend/src/toolbar/elements/heatmapToolbarMenuLogic.test.ts
index bc582b58f315..8324cb705e72 100644
--- a/frontend/src/toolbar/elements/heatmapToolbarMenuLogic.test.ts
+++ b/frontend/src/toolbar/elements/heatmapToolbarMenuLogic.test.ts
@@ -1,5 +1,6 @@
import { expectLogic } from 'kea-test-utils'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { initKeaTests } from '~/test/init'
import { toolbarApi } from '~/toolbar/toolbarApi'
import { toolbarConfigLogic } from '~/toolbar/toolbarConfigLogic'
@@ -27,6 +28,11 @@ function statsRow(overrides: Partial<ElementsEventType>): ElementsEventType {
}
describe('heatmapToolbarMenuLogic', () => {
+ // These suites intentionally reject requests to exercise error states; the
+ // failures are asserted via authStatus/values, so skip the global loader logging.
+ beforeAll(silenceKeaLoadersErrors)
+ afterAll(resumeKeaLoadersErrors)
+
describe('dedupeByChainIdentity', () => {
const cases = [
{
diff --git a/frontend/src/toolbar/experiments/experimentsLogic.test.ts b/frontend/src/toolbar/experiments/experimentsLogic.test.ts
index 4ed06d014384..1cb9b362215a 100644
--- a/frontend/src/toolbar/experiments/experimentsLogic.test.ts
+++ b/frontend/src/toolbar/experiments/experimentsLogic.test.ts
@@ -4,11 +4,18 @@ jest.mock('lib/lemon-ui/LemonToast/LemonToast', () => ({
lemonToast: { success: jest.fn(), error: jest.fn() },
}))
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { initKeaTests } from '~/test/init'
import { toolbarConfigLogic } from '~/toolbar/toolbarConfigLogic'
import { experimentsLogic } from './experimentsLogic'
+// The toolbar logger mirrors intentional error/auth paths to the console (its job on
+// customer pages); tests exercise those paths on purpose, so stub the boundary.
+jest.mock('~/toolbar/toolbarLogger', () => ({
+ toolbarLogger: { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn() },
+}))
+
const web_experiments = [{ id: 1, name: 'Test Experiment 1', variants: {} }]
function mockFetch(response: Partial<Response> & { json?: () => Promise<unknown> }): void {
@@ -16,6 +23,11 @@ function mockFetch(response: Partial<Response> & { json?: () => Promise<unknown>
}
describe('experimentsLogic', () => {
+ // These suites intentionally reject requests to exercise error states; the
+ // failures are asserted via authStatus/values, so skip the global loader logging.
+ beforeAll(silenceKeaLoadersErrors)
+ afterAll(resumeKeaLoadersErrors)
+
let logic: ReturnType<typeof experimentsLogic.build>
const savedFetch = global.fetch
diff --git a/frontend/src/toolbar/experiments/experimentsTabLogic.test.ts b/frontend/src/toolbar/experiments/experimentsTabLogic.test.ts
index 1e98a1b121b3..7565e9fcb814 100644
--- a/frontend/src/toolbar/experiments/experimentsTabLogic.test.ts
+++ b/frontend/src/toolbar/experiments/experimentsTabLogic.test.ts
@@ -15,6 +15,12 @@ import { toolbarConfigLogic } from '~/toolbar/toolbarConfigLogic'
import { experimentsLogic } from './experimentsLogic'
import { experimentsTabLogic } from './experimentsTabLogic'
+// The toolbar logger mirrors intentional error/auth paths to the console (its job on
+// customer pages); tests exercise those paths on purpose, so stub the boundary.
+jest.mock('~/toolbar/toolbarLogger', () => ({
+ toolbarLogger: { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn() },
+}))
+
const web_experiments = [
{
id: 1,
diff --git a/frontend/src/toolbar/flags/flagsToolbarLogic.test.ts b/frontend/src/toolbar/flags/flagsToolbarLogic.test.ts
index 3f31574397b6..ef49d6c50553 100644
--- a/frontend/src/toolbar/flags/flagsToolbarLogic.test.ts
+++ b/frontend/src/toolbar/flags/flagsToolbarLogic.test.ts
@@ -5,6 +5,12 @@ import { flagsToolbarLogic } from '~/toolbar/flags/flagsToolbarLogic'
import { toolbarConfigLogic } from '~/toolbar/toolbarConfigLogic'
import { CombinedFeatureFlagAndValueType } from '~/types'
+// The toolbar logger mirrors intentional error/auth paths to the console (its job on
+// customer pages); tests exercise those paths on purpose, so stub the boundary.
+jest.mock('~/toolbar/toolbarLogger', () => ({
+ toolbarLogger: { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn() },
+}))
+
const featureFlags = [
{ feature_flag: { key: 'flag 1' } },
{ feature_flag: { key: 'flag 2' } },
diff --git a/frontend/src/toolbar/index.test.ts b/frontend/src/toolbar/index.test.ts
index 57b2c7fd7b63..571b93d2a99f 100644
--- a/frontend/src/toolbar/index.test.ts
+++ b/frontend/src/toolbar/index.test.ts
@@ -71,6 +71,7 @@ describe('Toolbar flag loading', () => {
it('should handle fetch errors gracefully', async () => {
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
+ const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation()
await import('./index')
@@ -95,10 +96,12 @@ describe('Toolbar flag loading', () => {
expect(mockPostHog.featureFlags.overrideFeatureFlags).not.toHaveBeenCalled()
consoleErrorSpy.mockRestore()
+ consoleWarnSpy.mockRestore()
})
it('should handle non-ok responses gracefully', async () => {
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
+ const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation()
await import('./index')
@@ -126,6 +129,7 @@ describe('Toolbar flag loading', () => {
expect(mockPostHog.featureFlags.overrideFeatureFlags).not.toHaveBeenCalled()
consoleErrorSpy.mockRestore()
+ consoleWarnSpy.mockRestore()
})
it.each([
diff --git a/frontend/src/toolbar/toolbarConfigLogic.test.ts b/frontend/src/toolbar/toolbarConfigLogic.test.ts
index ed301861b9cd..1705453f775f 100644
--- a/frontend/src/toolbar/toolbarConfigLogic.test.ts
+++ b/frontend/src/toolbar/toolbarConfigLogic.test.ts
@@ -1,10 +1,17 @@
import { expectLogic } from 'kea-test-utils'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { initKeaTests } from '~/test/init'
import { canonicalizeApiHost, canonicalizeUiHost, toolbarConfigLogic } from '~/toolbar/toolbarConfigLogic'
import { toolbarFetch, toolbarUploadMedia } from '~/toolbar/toolbarFetch'
import { cleanToolbarAuthHash, OAUTH_LOCALSTORAGE_KEY, PKCE_STORAGE_KEY, readToolbarAuthHash } from '~/toolbar/utils'
+// The toolbar logger mirrors intentional error/auth paths to the console (its job on
+// customer pages); tests exercise those paths on purpose, so stub the boundary.
+jest.mock('~/toolbar/toolbarLogger', () => ({
+ toolbarLogger: { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn() },
+}))
+
// The toolbar calls `global.fetch` directly (not the app api client / MSW). Reassign the mock per
// test in beforeEach — the MSW jest harness installs its own `global.fetch` in a global beforeAll,
// which runs after this module loads and would otherwise clobber a top-level assignment.
@@ -33,6 +40,11 @@ function mockTokenExchangeSuccess(): void {
}
describe('toolbar toolbarConfigLogic', () => {
+ // These suites intentionally reject requests to exercise error states; the
+ // failures are asserted via authStatus/values, so skip the global loader logging.
+ beforeAll(silenceKeaLoadersErrors)
+ afterAll(resumeKeaLoadersErrors)
+
let mockOpen: jest.SpyInstance
beforeEach(() => {
diff --git a/frontend/src/toolbar/toolbarController.test.ts b/frontend/src/toolbar/toolbarController.test.ts
index 43522218d96c..72a7b934ddc7 100644
--- a/frontend/src/toolbar/toolbarController.test.ts
+++ b/frontend/src/toolbar/toolbarController.test.ts
@@ -9,6 +9,12 @@ import {
setToolbarRefs,
} from '~/toolbar/toolbarController'
+// The toolbar logger mirrors intentional error/auth paths to the console (its job on
+// customer pages); tests exercise those paths on purpose, so stub the boundary.
+jest.mock('~/toolbar/toolbarLogger', () => ({
+ toolbarLogger: { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn() },
+}))
+
global.fetch = jest.fn(() =>
Promise.resolve({
ok: true,
diff --git a/packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts b/packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts
index 736b86fd7227..5b96feb2ec68 100644
--- a/packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts
+++ b/packages/quill/packages/charts/src/core/hooks/useChartInteraction.test.ts
@@ -1,5 +1,4 @@
-import { renderHook, type RenderHookResult } from '@testing-library/react'
-import { act } from 'react'
+import { act, renderHook, type RenderHookResult } from '@testing-library/react'
import { dimensions } from '../../testing'
import type { ChartScales } from '../types'
diff --git a/packages/quill/packages/charts/src/core/hooks/useTooltipLifecycle.test.ts b/packages/quill/packages/charts/src/core/hooks/useTooltipLifecycle.test.ts
index bd004fcce9a5..bcf5043b1706 100644
--- a/packages/quill/packages/charts/src/core/hooks/useTooltipLifecycle.test.ts
+++ b/packages/quill/packages/charts/src/core/hooks/useTooltipLifecycle.test.ts
@@ -1,5 +1,4 @@
-import { renderHook, type RenderHookResult } from '@testing-library/react'
-import { act } from 'react'
+import { act, renderHook, type RenderHookResult } from '@testing-library/react'
import type { TooltipContext } from '../types'
import { isTooltipContextEquivalent, useTooltipLifecycle } from './useTooltipLifecycle'
diff --git a/packages/quill/packages/primitives/src/combobox.tsx b/packages/quill/packages/primitives/src/combobox.tsx
index 94118f1c1d21..81e4bff049e4 100644
--- a/packages/quill/packages/primitives/src/combobox.tsx
+++ b/packages/quill/packages/primitives/src/combobox.tsx
@@ -1,10 +1,11 @@
+import './combobox.css'
+
import { Combobox as ComboboxPrimitive } from '@base-ui/react'
import { ChevronDownIcon, XIcon, CheckIcon } from 'lucide-react'
import * as React from 'react'
import { Button } from './button'
import { Chip, ChipClose } from './chip'
-import './combobox.css'
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group'
import { cn } from './lib/utils'
import { MenuEmpty } from './menu-empty'
@@ -122,10 +123,7 @@ function ComboboxContent({
<ComboboxPrimitive.Popup
data-slot="combobox-content"
data-chips={!!anchor}
- className={cn(
- 'quill-combobox__content group/combobox-content',
- className
- )}
+ className={cn('quill-combobox__content group/combobox-content', className)}
{...props}
/>
</ComboboxPrimitive.Positioner>
@@ -146,7 +144,7 @@ function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props): Re
className={cn(
'quill-combobox__list scroll-mask-t-4 scroll-py-4',
'not-has-[[data-slot=combobox-list-footer]]:scroll-mask-b-4',
- className,
+ className
)}
{...props}
/>
@@ -164,6 +162,9 @@ function ComboboxItem({
data-slot="combobox-item"
className={cn('quill-combobox__item', className)}
title={title ?? (typeof children === 'string' ? children : undefined)}
+ // The default render is a real <button>; only declare nativeButton when the
+ // caller hasn't overridden render (their element may not be a button).
+ nativeButton={!('render' in props)}
render={<Button left className="min-w-0 aria-selected:bg-fill-selected" />}
{...props}
>
@@ -182,7 +183,14 @@ function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props):
}
function ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props): React.ReactElement {
- return <ComboboxPrimitive.GroupLabel data-slot="combobox-label" className={className} render={<MenuLabel />} {...props} />
+ return (
+ <ComboboxPrimitive.GroupLabel
+ data-slot="combobox-label"
+ className={className}
+ render={<MenuLabel />}
+ {...props}
+ />
+ )
}
function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props): React.ReactElement {
@@ -201,7 +209,13 @@ function ComboboxEmpty({ className, children, ...props }: ComboboxPrimitive.Empt
}
function ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props): React.ReactElement {
- return <ComboboxPrimitive.Separator data-slot="combobox-separator" className={cn('quill-combobox__separator', className)} {...props} />
+ return (
+ <ComboboxPrimitive.Separator
+ data-slot="combobox-separator"
+ className={cn('quill-combobox__separator', className)}
+ {...props}
+ />
+ )
}
function ComboboxChips({
diff --git a/packages/quill/packages/primitives/src/context-menu.tsx b/packages/quill/packages/primitives/src/context-menu.tsx
index f9d28e2522ce..0d52f2b67eb7 100644
--- a/packages/quill/packages/primitives/src/context-menu.tsx
+++ b/packages/quill/packages/primitives/src/context-menu.tsx
@@ -107,6 +107,9 @@ function ContextMenuItem({
inset && 'quill-menu-item--inset',
className
)}
+ // The default render is a real <button>; only declare nativeButton when the
+ // caller hasn't overridden render (their element may not be a button).
+ nativeButton={!('render' in props)}
render={<Button variant="default" className="w-full font-normal" left />}
{...props}
>
@@ -136,6 +139,9 @@ function ContextMenuSubTrigger({
inset && 'quill-menu-item--inset',
className
)}
+ // The default render is a real <button>; only declare nativeButton when the
+ // caller hasn't overridden render (their element may not be a button).
+ nativeButton={!('render' in props)}
render={<Button className="w-full font-normal" left />}
{...props}
>
@@ -183,6 +189,9 @@ function ContextMenuCheckboxItem({
"quill-menu-item--inset relative flex cursor-default items-center pe-2 text-xs outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
className
)}
+ // The default render is a real <button>; only declare nativeButton when the
+ // caller hasn't overridden render (their element may not be a button).
+ nativeButton={!('render' in props)}
render={<Button className="w-full font-normal" left />}
checked={checked}
{...props}
@@ -218,6 +227,9 @@ function ContextMenuRadioItem({
"quill-menu-item--inset relative flex cursor-default items-center pe-2 outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
className
)}
+ // The default render is a real <button>; only declare nativeButton when the
+ // caller hasn't overridden render (their element may not be a button).
+ nativeButton={!('render' in props)}
render={<Button className="w-full font-normal" left />}
{...props}
>
diff --git a/packages/quill/packages/primitives/src/dropdown-menu.tsx b/packages/quill/packages/primitives/src/dropdown-menu.tsx
index 15493201f1b2..1fa9b69add10 100644
--- a/packages/quill/packages/primitives/src/dropdown-menu.tsx
+++ b/packages/quill/packages/primitives/src/dropdown-menu.tsx
@@ -108,6 +108,9 @@ function DropdownMenuItem({
inset && 'quill-menu-item--inset',
className
)}
+ // The default render is a real <button>; only declare nativeButton when the
+ // caller hasn't overridden render (their element may not be a button).
+ nativeButton={!('render' in props)}
render={<Button variant="default" className="w-full font-normal [&_kbd]:ml-auto" left />}
{...props}
/>
@@ -135,6 +138,9 @@ function DropdownMenuSubTrigger({
inset && 'quill-menu-item--inset',
className
)}
+ // The default render is a real <button>; only declare nativeButton when the
+ // caller hasn't overridden render (their element may not be a button).
+ nativeButton={!('render' in props)}
render={<Button className="w-full font-normal" left />}
{...props}
>
@@ -183,6 +189,9 @@ function DropdownMenuCheckboxItem({
className
)}
checked={checked}
+ // The default render is a real <button>; only declare nativeButton when the
+ // caller hasn't overridden render (their element may not be a button).
+ nativeButton={!('render' in props)}
render={<Button className="w-full font-normal" left />}
{...props}
>
@@ -220,6 +229,9 @@ function DropdownMenuRadioItem({
"quill-menu-item--inset relative flex min-h-7 cursor-default items-center pe-2 text-xs outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
className
)}
+ // The default render is a real <button>; only declare nativeButton when the
+ // caller hasn't overridden render (their element may not be a button).
+ nativeButton={!('render' in props)}
render={<Button className="w-full font-normal" left />}
{...props}
>
diff --git a/products/ai_observability/frontend/clusters/clustersLogic.test.ts b/products/ai_observability/frontend/clusters/clustersLogic.test.ts
index f7dbc1659f18..0fc17975b0c7 100644
--- a/products/ai_observability/frontend/clusters/clustersLogic.test.ts
+++ b/products/ai_observability/frontend/clusters/clustersLogic.test.ts
@@ -736,6 +736,10 @@ describe('clustersLogic', () => {
// exists to suppress stale cards during a level switch) treats the seed as live.
logic.actions.loadClusteringRunSuccess({
runId: 'test-run',
+ // Without window bounds the success listeners interpolate undefined
+ // into hogql templates and log load failures.
+ windowStart: '2026-04-19T00:00:00Z',
+ windowEnd: '2026-04-21T00:00:00Z',
clusters: sampleClusters,
level: level ?? logic.values.clusteringLevel,
} as ClusteringRun)
diff --git a/products/ai_observability/frontend/datasets/aiObservabilityDatasetLogic.test.ts b/products/ai_observability/frontend/datasets/aiObservabilityDatasetLogic.test.ts
index cf8d61b3e5d2..854d7e355ec3 100644
--- a/products/ai_observability/frontend/datasets/aiObservabilityDatasetLogic.test.ts
+++ b/products/ai_observability/frontend/datasets/aiObservabilityDatasetLogic.test.ts
@@ -86,8 +86,11 @@ describe('aiObservabilityDatasetLogic', () => {
jest.spyOn(mockApi.datasets, 'create').mockResolvedValue(undefined as any)
jest.spyOn(mockApi.datasets, 'update').mockResolvedValue(undefined as any)
- jest.spyOn(mockApi.datasets, 'get').mockResolvedValue(undefined as any)
- jest.spyOn(mockApi.datasets, 'list').mockResolvedValue(undefined as any)
+ // Mounting with an existing datasetId fires loadDataset/loadDatasetItems/loadDatasets;
+ // resolving undefined makes each loader reducer log a KEA error. Default to real shapes.
+ jest.spyOn(mockApi.datasets, 'get').mockResolvedValue(mockDataset as any)
+ jest.spyOn(mockApi.datasets, 'list').mockResolvedValue({ results: [], count: 0 } as any)
+ jest.spyOn(mockApi.datasetItems, 'list').mockResolvedValue({ results: [], count: 0, offset: 0 } as any)
})
describe('new dataset creation', () => {
diff --git a/products/ai_observability/frontend/modelPickerLogic.test.ts b/products/ai_observability/frontend/modelPickerLogic.test.ts
index 605955c5c08e..6482105e155a 100644
--- a/products/ai_observability/frontend/modelPickerLogic.test.ts
+++ b/products/ai_observability/frontend/modelPickerLogic.test.ts
@@ -114,6 +114,7 @@ describe('modelPickerLogic', () => {
it('should return empty array when no valid keys exist', async () => {
useMocks({
get: {
+ '/api/llm_proxy/models/': () => [200, []],
'/api/environments/:team_id/llm_analytics/provider_keys/': {
results: [{ id: 'key-1', provider: 'openai', state: 'invalid' }],
},
@@ -235,6 +236,7 @@ describe('modelPickerLogic', () => {
it('should return false when all keys are non-ok', async () => {
useMocks({
get: {
+ '/api/llm_proxy/models/': () => [200, []],
'/api/environments/:team_id/llm_analytics/provider_keys/': {
results: [
{ id: 'key-1', provider: 'openai', state: 'invalid' },
@@ -257,6 +259,7 @@ describe('modelPickerLogic', () => {
it('should return false when no keys exist', async () => {
useMocks({
get: {
+ '/api/llm_proxy/models/': () => [200, []],
'/api/environments/:team_id/llm_analytics/provider_keys/': {
results: [],
},
diff --git a/products/ai_observability/frontend/traceReviews/aiObservabilityReviewsLogic.test.ts b/products/ai_observability/frontend/traceReviews/aiObservabilityReviewsLogic.test.ts
index a9b285881230..8eda095fc4a4 100644
--- a/products/ai_observability/frontend/traceReviews/aiObservabilityReviewsLogic.test.ts
+++ b/products/ai_observability/frontend/traceReviews/aiObservabilityReviewsLogic.test.ts
@@ -28,7 +28,9 @@ jest.mock('./traceReviewsApi', () => ({
},
}))
jest.mock('../generated/api', () => ({
- aiObservabilityScoreDefinitionsList: jest
+ ...jest.requireActual('../generated/api'),
+ // The logic imports this under the alias aiObservabilityScoreDefinitionsList.
+ llmAnalyticsScoreDefinitionsList: jest
.fn()
.mockResolvedValue({ results: [], count: 0, next: null, previous: null }),
}))
diff --git a/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.test.ts b/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.test.ts
index c686a7b0d70e..348de57967e0 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.test.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.test.ts
@@ -11,6 +11,10 @@ import type { AccountApi } from 'products/customer_analytics/frontend/generated/
import { accountLinksLogic } from './accountLinksLogic'
jest.mock('products/customer_analytics/frontend/generated/api', () => ({
+ // Keep the real module for everything else — connected logics (e.g. column config's
+ // customPropertyDefinitionsList) call other generated functions on mount, and an
+ // absent export makes their loaders throw on every test.
+ ...jest.requireActual('products/customer_analytics/frontend/generated/api'),
accountsRetrieve: jest.fn(),
accountsPartialUpdate: jest.fn(),
}))
diff --git a/products/customer_analytics/frontend/components/Accounts/accountNotebooksLogic.test.ts b/products/customer_analytics/frontend/components/Accounts/accountNotebooksLogic.test.ts
index 1842838d260e..2d1cf193c783 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountNotebooksLogic.test.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountNotebooksLogic.test.ts
@@ -15,6 +15,10 @@ import type {
import { accountNotebooksLogic, NOTES_PER_PAGE } from './accountNotebooksLogic'
jest.mock('products/customer_analytics/frontend/generated/api', () => ({
+ // Keep the real module for everything else — connected logics (e.g. column config's
+ // customPropertyDefinitionsList) call other generated functions on mount, and an
+ // absent export makes their loaders throw on every test.
+ ...jest.requireActual('products/customer_analytics/frontend/generated/api'),
accountsNotebooksList: jest.fn(),
accountsNotebooksCreate: jest.fn(),
}))
diff --git a/products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.test.ts b/products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.test.ts
index 8b278f70397c..45b333bdd248 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.test.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.test.ts
@@ -11,6 +11,10 @@ import type { AccountApi, AccountApiProperties } from 'products/customer_analyti
import { accountOpportunitiesLogic } from './accountOpportunitiesLogic'
jest.mock('products/customer_analytics/frontend/generated/api', () => ({
+ // Keep the real module for everything else — connected logics (e.g. column config's
+ // customPropertyDefinitionsList) call other generated functions on mount, and an
+ // absent export makes their loaders throw on every test.
+ ...jest.requireActual('products/customer_analytics/frontend/generated/api'),
accountsRetrieve: jest.fn(),
}))
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsLogic.test.ts b/products/customer_analytics/frontend/components/Accounts/accountsLogic.test.ts
index fbf2eb661c88..cca9c27cc5b7 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsLogic.test.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsLogic.test.ts
@@ -27,6 +27,10 @@ import { accountsLogic, savingRoleKey } from './accountsLogic'
const orderByOf = (source: unknown): AccountsQuery['orderBy'] => (source as AccountsQuery).orderBy
jest.mock('products/customer_analytics/frontend/generated/api', () => ({
+ // Keep the real module for everything else — connected logics (e.g. column config's
+ // customPropertyDefinitionsList) call other generated functions on mount, and an
+ // absent export makes their loaders throw on every test.
+ ...jest.requireActual('products/customer_analytics/frontend/generated/api'),
accountsRetrieve: jest.fn(),
accountsPartialUpdate: jest.fn(),
}))
diff --git a/products/logs/frontend/components/LogsAlerting/__tests__/logsAlertFormLogic.test.ts b/products/logs/frontend/components/LogsAlerting/__tests__/logsAlertFormLogic.test.ts
index 58bba2c6d36d..f182b272dd2a 100644
--- a/products/logs/frontend/components/LogsAlerting/__tests__/logsAlertFormLogic.test.ts
+++ b/products/logs/frontend/components/LogsAlerting/__tests__/logsAlertFormLogic.test.ts
@@ -93,13 +93,13 @@ describe('logsAlertFormLogic', () => {
initKeaTests()
jest.clearAllMocks()
- alertingLogic = logsAlertingLogic.build()
- alertingLogic.mount()
- // Prevent afterMount loadAlerts from throwing
+ // Prevent afterMount loadAlerts from throwing — must be set before mount() fires it
;(require('products/logs/frontend/generated/api').logsAlertsList as jest.Mock).mockResolvedValue({
results: [],
count: 0,
})
+ alertingLogic = logsAlertingLogic.build()
+ alertingLogic.mount()
})
afterEach(() => {
diff --git a/products/logs/frontend/components/LogsAlerting/__tests__/logsAlertNotificationLogic.test.ts b/products/logs/frontend/components/LogsAlerting/__tests__/logsAlertNotificationLogic.test.ts
index d753626270c3..45cf54a8ca38 100644
--- a/products/logs/frontend/components/LogsAlerting/__tests__/logsAlertNotificationLogic.test.ts
+++ b/products/logs/frontend/components/LogsAlerting/__tests__/logsAlertNotificationLogic.test.ts
@@ -11,14 +11,16 @@ import { logsAlertsDestinationsCreate, logsAlertsDestinationsDeleteCreate } from
import { logsAlertNotificationLogic } from '../logsAlertNotificationLogic'
import { buildLogsAlertFilterConfig, LogsAlertDestinationGroup } from '../logsAlertUtils'
-jest.mock('lib/api', () => ({
- __esModule: true,
- default: {
- hogFunctions: {
- list: jest.fn(),
- },
- },
-}))
+jest.mock('lib/api', () => {
+ // Keep the real module: the connected integrationsLogic calls api.integrations.list()
+ // on mount, which resolves via the MSW floor. Only hogFunctions is stubbed.
+ const actual = jest.requireActual('lib/api')
+ return {
+ ...actual,
+ __esModule: true,
+ default: { ...actual.default, hogFunctions: { list: jest.fn() } },
+ }
+})
jest.mock('products/logs/frontend/generated/api', () => ({
__esModule: true,
diff --git a/products/logs/frontend/components/LogsPatterns/logsPatternsLogic.test.ts b/products/logs/frontend/components/LogsPatterns/logsPatternsLogic.test.ts
index 4fc9abf4cca4..fa45349a355b 100644
--- a/products/logs/frontend/components/LogsPatterns/logsPatternsLogic.test.ts
+++ b/products/logs/frontend/components/LogsPatterns/logsPatternsLogic.test.ts
@@ -1,5 +1,6 @@
import { expectLogic } from 'kea-test-utils'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { initKeaTests } from '~/test/init'
import { FilterLogicalOperator, PropertyFilterType, PropertyOperator, UniversalFiltersGroup } from '~/types'
@@ -51,6 +52,7 @@ const RESPONSE: _LogsPatternsResponseApi = {
}
describe('logsPatternsLogic', () => {
+ afterEach(resumeKeaLoadersErrors)
let logic: ReturnType<typeof logsPatternsLogic.build>
let filtersLogic: ReturnType<typeof logsViewerFiltersLogic.build>
@@ -136,6 +138,7 @@ describe('logsPatternsLogic', () => {
})
it('surfaces a load failure as patternsError and clears it on the next success', async () => {
+ silenceKeaLoadersErrors()
// A failed mine (e.g. sampling query over budget) must not render as "no patterns".
mockCreate.mockRejectedValueOnce(new Error('estimated query execution time is too long'))
logic.mount()
diff --git a/products/logs/frontend/components/LogsViewer/data/logsViewerDataLogic.ts b/products/logs/frontend/components/LogsViewer/data/logsViewerDataLogic.ts
index 578173a5700f..6a36c882c470 100644
--- a/products/logs/frontend/components/LogsViewer/data/logsViewerDataLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/data/logsViewerDataLogic.ts
@@ -689,19 +689,19 @@ export const logsViewerDataLogic = kea<logsViewerDataLogicType>([
},
cancelInProgressLogs: ({ logsAbortController }) => {
if (values.logsAbortController !== null) {
- values.logsAbortController.abort(NEW_QUERY_STARTED_ERROR_MESSAGE)
+ values.logsAbortController.abort(new DOMException(NEW_QUERY_STARTED_ERROR_MESSAGE, 'AbortError'))
}
actions.setLogsAbortController(logsAbortController)
},
cancelInProgressSparkline: ({ sparklineAbortController }) => {
if (values.sparklineAbortController !== null) {
- values.sparklineAbortController.abort(NEW_QUERY_STARTED_ERROR_MESSAGE)
+ values.sparklineAbortController.abort(new DOMException(NEW_QUERY_STARTED_ERROR_MESSAGE, 'AbortError'))
}
actions.setSparklineAbortController(sparklineAbortController)
},
cancelInProgressLiveTail: ({ liveTailAbortController }) => {
if (values.liveTailAbortController !== null) {
- values.liveTailAbortController.abort('live tail request cancelled')
+ values.liveTailAbortController.abort(new DOMException('live tail request cancelled', 'AbortError'))
}
actions.setLiveTailAbortController(liveTailAbortController)
cache.disposables.dispose('liveTailTimer')
diff --git a/products/logs/frontend/components/LogsViewer/logsExportLogic.test.ts b/products/logs/frontend/components/LogsViewer/logsExportLogic.test.ts
index cb1bf78b8187..eecdeb4b62f6 100644
--- a/products/logs/frontend/components/LogsViewer/logsExportLogic.test.ts
+++ b/products/logs/frontend/components/LogsViewer/logsExportLogic.test.ts
@@ -43,6 +43,10 @@ describe('logsExportLogic', () => {
localStorage.clear()
initKeaTests()
jest.clearAllMocks()
+ // logsViewerLogic fetches on mount; the automocked api.logs must resolve the
+ // shapes the loaders destructure (hasMore, maxExportableLogs).
+ ;(api.logs.query as jest.Mock).mockResolvedValue({ results: [], hasMore: false, maxExportableLogs: 10000 })
+ ;(api.logs.sparkline as jest.Mock).mockResolvedValue([])
viewerLogic = logsViewerLogic({ id: 'test-tab' })
viewerLogic.mount()
diff --git a/products/logs/frontend/components/SetupPrompt/logsIngestionLogic.test.ts b/products/logs/frontend/components/SetupPrompt/logsIngestionLogic.test.ts
index 5db78c8c1209..340bcfb37326 100644
--- a/products/logs/frontend/components/SetupPrompt/logsIngestionLogic.test.ts
+++ b/products/logs/frontend/components/SetupPrompt/logsIngestionLogic.test.ts
@@ -1,5 +1,6 @@
import { expectLogic } from 'kea-test-utils'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -25,6 +26,7 @@ jest.mock('lib/utils/async', () => ({
}))
describe('logsIngestionLogic', () => {
+ afterEach(resumeKeaLoadersErrors)
let logic: ReturnType<typeof logsIngestionLogic.build>
beforeEach(() => {
@@ -73,6 +75,7 @@ describe('logsIngestionLogic', () => {
})
it('handles API failure and sets teamHasLogsCheckFailed', async () => {
+ silenceKeaLoadersErrors()
useMocks({
get: {
'/api/environments/:team_id/logs/has_logs/': () => [500, { detail: 'Server error' }],
@@ -107,6 +110,7 @@ describe('logsIngestionLogic', () => {
})
it('resets teamHasLogsCheckFailed on new load attempt', async () => {
+ silenceKeaLoadersErrors()
let callCount = 0
useMocks({
get: {
diff --git a/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.test.ts b/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.test.ts
index 1b712cd3e6fd..917d064da2b3 100644
--- a/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.test.ts
+++ b/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.test.ts
@@ -1,5 +1,6 @@
import { expectLogic } from 'kea-test-utils'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -19,6 +20,7 @@ jest.mock('lib/utils/async', () => {
})
describe('tracingIngestionLogic', () => {
+ afterEach(resumeKeaLoadersErrors)
let logic: ReturnType<typeof tracingIngestionLogic.build>
beforeEach(() => {
@@ -53,6 +55,7 @@ describe('tracingIngestionLogic', () => {
})
it('handles API failure and sets teamHasSpansCheckFailed', async () => {
+ silenceKeaLoadersErrors()
useMocks({
get: {
'/api/environments/:team_id/tracing/spans/has_spans/': () => [500, { detail: 'Server error' }],
@@ -87,6 +90,7 @@ describe('tracingIngestionLogic', () => {
})
it('resets teamHasSpansCheckFailed on new load attempt', async () => {
+ silenceKeaLoadersErrors()
let callCount = 0
useMocks({
get: {
diff --git a/products/tracing/frontend/tracingDataLogic.test.ts b/products/tracing/frontend/tracingDataLogic.test.ts
index 1958f151f3b0..c12303445d39 100644
--- a/products/tracing/frontend/tracingDataLogic.test.ts
+++ b/products/tracing/frontend/tracingDataLogic.test.ts
@@ -4,6 +4,7 @@ import { lemonToast } from '@posthog/lemon-ui'
import api from 'lib/api'
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { AggregatedSpanRow } from '~/queries/schema/schema-general'
import { initKeaTests } from '~/test/init'
@@ -60,6 +61,7 @@ function mountWithSpans(spans: Span[] = mockSpans): ReturnType<typeof tracingDat
}
describe('tracingDataLogic', () => {
+ afterEach(resumeKeaLoadersErrors)
let logic: ReturnType<typeof tracingDataLogic.build>
beforeEach(() => {
@@ -274,6 +276,7 @@ describe('tracingDataLogic', () => {
})
it('toasts on a real count failure', async () => {
+ silenceKeaLoadersErrors()
const toastSpy = jest.spyOn(lemonToast, 'error').mockReturnValue(undefined as any)
jest.spyOn(api.tracing, 'count').mockRejectedValue(new Error('boom'))
logic = mountWithSpans([])
diff --git a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.test.ts b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.test.ts
index 7318b3799819..35d0303dab20 100644
--- a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.test.ts
+++ b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.test.ts
@@ -15,6 +15,42 @@ import {
parseGroupsFromResult,
} from './hogFlowEditorTestLogic'
+// Mounting hogFlowEditorTestLogic mounts workflowLogic, whose afterMount loads the hog
+// flow; without a valid fixture the editor's resetFlowFromHogFlow crashes and logs.
+const WORKFLOW_FIXTURE = {
+ id: 'test-workflow',
+ name: 'Test workflow',
+ actions: [
+ {
+ id: 'trigger_node',
+ type: 'trigger',
+ name: 'Trigger',
+ description: '',
+ created_at: 0,
+ updated_at: 0,
+ config: { type: 'event', filters: {} },
+ },
+ {
+ id: 'exit_node',
+ type: 'exit',
+ name: 'Exit',
+ description: '',
+ created_at: 0,
+ updated_at: 0,
+ config: { reason: 'Default exit' },
+ },
+ ],
+ edges: [{ from: 'trigger_node', to: 'exit_node', type: 'continue' }],
+ conversion: { window_minutes: null, filters: [] },
+ exit_condition: 'exit_only_at_end',
+ version: 1,
+ status: 'draft',
+ team_id: 1,
+ trigger: { type: 'event', filters: {} },
+ created_at: '2026-05-01T00:00:00.000Z',
+ updated_at: '2026-05-01T00:00:00.000Z',
+}
+
describe('hogFlowEditorTestLogic', () => {
let logic: ReturnType<typeof hogFlowEditorTestLogic.build>
@@ -112,6 +148,7 @@ describe('hogFlowEditorTestLogic', () => {
beforeEach(() => {
initKeaTests()
+ useMocks({ get: { '/api/environments/:team_id/hog_flows/:id/': WORKFLOW_FIXTURE } })
})
describe('groupTypesForTest gating on group_analytics', () => {