diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml index a1a38a751c6..f62f5879353 100644 --- a/.github/workflows/ci-backend.yml +++ b/.github/workflows/ci-backend.yml @@ -61,8 +61,10 @@ jobs: # the dependencies more clear if we separated the backend/frontend # code completely # really we should ignore ee/frontend/** but dorny doesn't support that + # - '!ee/frontend/**' + # including the negated rule appears to work + # but makes it always match because the checked file always isn't `ee/frontend/**` 🙈 - 'ee/**/*' - - '!ee/frontend/**' - 'posthog/**/*' - 'bin/*.py' - requirements.txt diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 502946a9a07..854e5b657e4 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -1555,17 +1555,18 @@ const api = { .withQueryString(toParams({ source: 'blob', blob_key: blobKey, version: '2' })) .getResponse() + const contentBuffer = new Uint8Array(await response.arrayBuffer()) try { - const textLines = await response.text() + const textDecoder = new TextDecoder() + const textLines = textDecoder.decode(contentBuffer) if (textLines) { return textLines.split('\n') } } catch (e) { - // Must be gzipped + // we assume it is gzipped, swallow the error, and carry on below } - const contentBuffer = new Uint8Array(await response.arrayBuffer()) return strFromU8(decompressSync(contentBuffer)).trim().split('\n') }, diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.test.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.test.ts index adf0e836d45..e75910bb916 100644 --- a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.test.ts +++ b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.test.ts @@ -127,6 +127,7 @@ describe('sessionRecordingDataLogic', () => { }) resumeKeaLoadersErrors() }) + it('fetch metadata success and snapshots error', async () => { silenceKeaLoadersErrors() // Unmount and remount the logic to trigger fetching the data again after the mock change diff --git a/jest.setup.ts b/jest.setup.ts index 847624fd022..cab389d3d46 100644 --- a/jest.setup.ts +++ b/jest.setup.ts @@ -1,6 +1,12 @@ import 'whatwg-fetch' import 'jest-canvas-mock' +import { TextEncoder, TextDecoder } from 'util' +// Jest/JSDom don't know about TextEncoder but the browsers we support do +// https://github.com/jsdom/jsdom/issues/2524 +global.TextDecoder = TextDecoder +global.TextEncoder = TextEncoder + window.scrollTo = jest.fn() window.matchMedia = jest.fn( () => ({ matches: false, addListener: jest.fn(), removeListener: jest.fn() } as MediaQueryList)